Skip to content

Commit 26e3030

Browse files
author
patched.codes[bot]
committed
Patched sqli/dao/user.py
1 parent 655044d commit 26e3030

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sqli/dao/user.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
from hashlib import md5
1+
from hashlib import scrypt as scrypt_hash
22
from typing import NamedTuple, Optional
3-
43
from aiopg import Connection
54

6-
75
class User(NamedTuple):
86
id: int
97
first_name: str
@@ -38,4 +36,6 @@ async def get_by_username(conn: Connection, username: str):
3836
return User.from_raw(await cur.fetchone())
3937

4038
def check_password(self, password: str):
41-
return self.pwd_hash == md5(password.encode('utf-8')).hexdigest()
39+
salt = self.pwd_hash.split('$')[1]
40+
return scrypt_hash(password.encode('utf-8'), salt.encode('utf-8'), 16384, 8, 1, 32).hex() == self.pwd_hash
41+

0 commit comments

Comments
 (0)