PyMenuSite/hasher.py
2023-02-11 16:06:36 +01:00

10 lines
253 B
Python

import bcrypt
def hash_text(text:str) -> bytes:
text = bytes(text, "utf-8")
return (bcrypt.hashpw(text, bcrypt.gensalt()))
def is_same(text:str, hashed: bytes) -> bool:
text = text.encode("utf-8")
return (bcrypt.checkpw(text, hashed))