Lab2: PostgreSQL, Bearer sessions and Redis for grade 4

This commit is contained in:
2026-10-29 01:25:40 +03:00
parent 65003b6119
commit 3c5af42f24
35 changed files with 2126 additions and 25 deletions
+18
View File
@@ -0,0 +1,18 @@
"""Password KDF: Argon2id (библиотечный)."""
from argon2 import PasswordHasher
from argon2.exceptions import VerifyMismatchError
_hasher = PasswordHasher()
def hash_password(password: str) -> str:
return _hasher.hash(password)
def verify_password(password_hash: str, password: str) -> bool:
try:
return _hasher.verify(password_hash, password)
except VerifyMismatchError:
return False
except Exception:
return False