changed from sha512 to scrypt for improved security
This commit is contained in:
+2
-2
@@ -39,7 +39,7 @@ def hashing(password):
|
|||||||
Returns:
|
Returns:
|
||||||
str: Hexadecimal digest of the hashed password
|
str: Hexadecimal digest of the hashed password
|
||||||
"""
|
"""
|
||||||
return hashlib.sha512(password.encode()).hexdigest()
|
return hashlib.scrypt(password.encode(), salt=b'salt_1234567890').hexdigest()
|
||||||
|
|
||||||
|
|
||||||
def check_nm_pwd(username, password):
|
def check_nm_pwd(username, password):
|
||||||
@@ -56,7 +56,7 @@ def check_nm_pwd(username, password):
|
|||||||
client = None
|
client = None
|
||||||
try:
|
try:
|
||||||
client, users = _get_users_collection()
|
client, users = _get_users_collection()
|
||||||
hashed_password = hashlib.sha512(password.encode()).hexdigest()
|
hashed_password = hashing(password)
|
||||||
return users.find_one({'Username': username, 'Password': hashed_password})
|
return users.find_one({'Username': username, 'Password': hashed_password})
|
||||||
finally:
|
finally:
|
||||||
if client:
|
if client:
|
||||||
|
|||||||
Reference in New Issue
Block a user