Skip to content

Commit d9a52c6

Browse files
committed
Updated password encryption to SHA3-512
1 parent fd884a4 commit d9a52c6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

backend/PyMatcha/models/user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class User(Model):
6767
def check_password(self, password: str) -> bool:
6868
logging.debug("Checking password again {} hashed password".format(self.id))
6969
_hash, salt = self.password.split(":")
70-
return _hash == hashlib.sha256(salt.encode() + password.encode()).hexdigest()
70+
return _hash == hashlib.sha3_512(salt.encode() + password.encode()).hexdigest()
7171

7272
@staticmethod
7373
def create(

backend/PyMatcha/utils/password.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
def hash_password(password: str) -> str:
2525
salt = uuid.uuid4().hex
2626
logging.debug("Hashing password with salt {}".format(salt))
27-
return hashlib.sha256(salt.encode() + password.encode()).hexdigest() + ":" + salt
27+
return hashlib.sha3_512(salt.encode() + password.encode()).hexdigest() + ":" + salt

0 commit comments

Comments
 (0)