diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-01-13 19:23:25 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-01-13 19:23:25 +0100 |
commit | 4e918ce7cbc2bb18823a233abf3dc1c6a260ecc4 (patch) | |
tree | bde86bd6190cf497c7f66c4ffd1a8d71dbb15fff /api/passwords.py | |
parent | 26631dadc7cf1406060f2574ce3dda484066ac6a (diff) |
user registration api endpoint
Diffstat (limited to 'api/passwords.py')
-rw-r--r-- | api/passwords.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/api/passwords.py b/api/passwords.py new file mode 100644 index 0000000..58b712d --- /dev/null +++ b/api/passwords.py @@ -0,0 +1,13 @@ +import bcrypt + +def enc(string): + return string.encode('utf-8') + +def salt(): + return bcrypt.gensalt() + +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); |