Added some api endpoints

This commit is contained in:
2022-03-14 07:32:16 +01:00
parent c5b6e85c4d
commit 00921dc505
4 changed files with 84 additions and 12 deletions

View File

@@ -0,0 +1,12 @@
import hashlib
import uuid
def hash_password(password):
salt = uuid.uuid4().hex
return hashlib.sha256(salt.encode() + password.encode()).hexdigest() + ':' + salt
def check_password(hashed_password, user_password):
password, salt = hashed_password.split(':')
return password == hashlib.sha256(salt.encode() + user_password.encode()).hexdigest()