Added some api endpoints
This commit is contained in:
12
webservice/helper_functions.py
Normal file
12
webservice/helper_functions.py
Normal 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()
|
||||
Reference in New Issue
Block a user