Skip to content

Commit

Permalink
Patched /tmp/tmp_n5ibaaf/sqli/dao/user.py
Browse files Browse the repository at this point in the history
  • Loading branch information
patched.codes[bot] committed Nov 11, 2024
1 parent 63210e7 commit 3331e4a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sqli/dao/user.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from hashlib import md5
from typing import NamedTuple, Optional

from aiopg import Connection
from cryptography.hazmat.primitives.kdf.argon2 import Argon2id


class User(NamedTuple):
Expand Down Expand Up @@ -38,4 +38,6 @@ async def get_by_username(conn: Connection, username: str):
return User.from_raw(await cur.fetchone())

def check_password(self, password: str):
return self.pwd_hash == md5(password.encode('utf-8')).hexdigest()
kdf = Argon2id(salt=b'secure_salt')
pwd_hashed = kdf.derive(password.encode('utf-8'))
return self.pwd_hash == pwd_hashed

0 comments on commit 3331e4a

Please sign in to comment.