diff options
| author | l3wdfut4pwr <l3wdfut4pwr@gmail.com> | 2026-04-21 13:32:24 +0300 |
|---|---|---|
| committer | l3wdfut4pwr <l3wdfut4pwr@gmail.com> | 2026-04-21 13:32:24 +0300 |
| commit | f1842be3bfabe7850d33662da2da377676144c48 (patch) | |
| tree | 95e1f5d6a72a2fc99847f0331907139b6b750dcb /app/utils/hash_cfg.py | |
| parent | 70b0706973d9d856ca9f136df23a6fbec0901aea (diff) | |
uv migration
Diffstat (limited to 'app/utils/hash_cfg.py')
| -rw-r--r-- | app/utils/hash_cfg.py | 13 |
1 files changed, 8 insertions, 5 deletions
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 |
