10 lines
213 B
Python
10 lines
213 B
Python
import hashlib
|
|
|
|
|
|
def hash_token(token: str) -> str:
|
|
return hashlib.sha256(token.encode("utf-8")).hexdigest()
|
|
|
|
|
|
def verify_token(plain: str, token_hash: str) -> bool:
|
|
return hash_token(plain) == token_hash
|