10 lines
228 B
Python
10 lines
228 B
Python
import secrets
|
|
|
|
from argon2 import PasswordHasher
|
|
|
|
def generate_secret(length: int = 32) -> str:
|
|
return secrets.token_hex(length)
|
|
|
|
def hash_secret(secret: str) -> str:
|
|
ph = PasswordHasher()
|
|
return ph.hash(secret) |