Перенести реализацию лабораторной 5

This commit is contained in:
2026-11-17 19:52:39 +03:00
parent 470d9d6f1e
commit 58f3d4c457
72 changed files with 4753 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
from argon2 import PasswordHasher
from argon2.exceptions import VerificationError, VerifyMismatchError
_hasher = PasswordHasher()
def hash_password(password: str) -> str:
return _hasher.hash(password)
def password_matches(stored_hash: str, password: str) -> bool:
try:
return _hasher.verify(stored_hash, password)
except (VerifyMismatchError, VerificationError):
return False