summaryrefslogtreecommitdiff
path: root/app/utils/hash_cfg.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/utils/hash_cfg.py')
-rw-r--r--app/utils/hash_cfg.py13
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