From 2f4536d6b08b69168ebf3e718cbd8e3002b9af5a Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 28 Mar 2021 12:19:28 +0200 Subject: added comments --- api/passwords.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'api/passwords.py') diff --git a/api/passwords.py b/api/passwords.py index e2ae552..8fa15c3 100644 --- a/api/passwords.py +++ b/api/passwords.py @@ -1,10 +1,14 @@ import bcrypt +# encode string as utf-8 def enc(string): 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) +# hash a password for storing in the database def password_hash(password): return bcrypt.hashpw(enc(password), bcrypt.gensalt()) + -- cgit v1.2.3