changed from sha512 to scrypt for improved security

This commit is contained in:
2026-06-22 00:22:47 +02:00
parent d59dd13a08
commit 75e6b3f2f9
+2 -2
View File
@@ -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: