diff options
Diffstat (limited to 'api/passwords.py')
-rw-r--r-- | api/passwords.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/api/passwords.py b/api/passwords.py index 8fa15c3..9cd56da 100644 --- a/api/passwords.py +++ b/api/passwords.py @@ -1,14 +1,16 @@ import bcrypt + # encode string as utf-8 def enc(string): - return string.encode('utf-8') + return string.encode('utf-8') + # check if password matches against hash in database def check_password(password, password_hash): - return bcrypt.checkpw(enc(password), password_hash) + return bcrypt.checkpw(enc(password), password_hash) + # hash a password for storing in the database def password_hash(password): - return bcrypt.hashpw(enc(password), bcrypt.gensalt()) - + return bcrypt.hashpw(enc(password), bcrypt.gensalt()) |