diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-01-14 21:31:22 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-01-14 21:31:22 +0100 |
commit | bf986adcf3f619860d18bda9e0c96e93ab97b260 (patch) | |
tree | d762866382928583d9b5b99f5694a82a54f3266f /api/passwords.py | |
parent | 999cf5cd082419bfce0e5147468e14d58465faae (diff) |
login
Diffstat (limited to 'api/passwords.py')
-rw-r--r-- | api/passwords.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/api/passwords.py b/api/passwords.py index 58b712d..011400e 100644 --- a/api/passwords.py +++ b/api/passwords.py @@ -3,11 +3,8 @@ import bcrypt def enc(string): return string.encode('utf-8') -def salt(): - return bcrypt.gensalt() +def check_password(password, password_hash): + return bcrypt.checkpw(enc(password), password_hash) -def check_password(password, salt, password_hash): - return bcrypt.checkpw(enc(password)+salt, enc(password_hash)) - -def password_hash(password, salt): - return bcrypt.hashpw(enc(password), salt); +def password_hash(password): + return bcrypt.hashpw(enc(password), bcrypt.gensalt()); |