PyMenuSite/hasher.py

10 lines
253 B
Python
Raw Permalink Normal View History

2023-02-11 10:06:36 -05:00
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))