10 lines
253 B
Python
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))
|