From f1842be3bfabe7850d33662da2da377676144c48 Mon Sep 17 00:00:00 2001 From: l3wdfut4pwr Date: Tue, 21 Apr 2026 13:32:24 +0300 Subject: uv migration --- app/utils/hash_cfg.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'app/utils/hash_cfg.py') diff --git a/app/utils/hash_cfg.py b/app/utils/hash_cfg.py index 9937c99..48242d2 100644 --- a/app/utils/hash_cfg.py +++ b/app/utils/hash_cfg.py @@ -1,7 +1,7 @@ -from passlib.hash import argon2 +from argon2 import PasswordHasher +from argon2.exceptions import VerifyMismatchError -argon2_hasher = argon2.using( - type="ID", +ph = PasswordHasher( time_cost=3, memory_cost=65536, parallelism=4, @@ -9,8 +9,11 @@ argon2_hasher = argon2.using( def hash_password(password: str) -> str: - return argon2_hasher.hash(password) + return ph.hash(password) def verify_password(password: str, hashed: str) -> bool: - return argon2_hasher.verify(password, hashed) + try: + return ph.verify(hashed, password) + except VerifyMismatchError: + return False -- cgit v1.3-3-g829e