Skip to content
Snippets Groups Projects
Commit a3e9e7a6 authored by Martin Mareš's avatar Martin Mareš
Browse files

Hešovací funkci na hesla snížen počet iterací

Defaultní hodnota je 12, ve skutečnosti je to binární logaritmus
počtu iterací. Sníženo na 9 => hešování zrychleno 4x.

Closes #132.
parent 62609c8f
No related branches found
No related tags found
No related merge requests found
...@@ -184,7 +184,7 @@ def validate_password(passwd: str) -> bool: ...@@ -184,7 +184,7 @@ def validate_password(passwd: str) -> bool:
def set_password(user: db.User, passwd: str, reset: bool = False): def set_password(user: db.User, passwd: str, reset: bool = False):
salt = bcrypt.gensalt() salt = bcrypt.gensalt(rounds=9)
hashed = bcrypt.hashpw(passwd.encode('utf-8'), salt) hashed = bcrypt.hashpw(passwd.encode('utf-8'), salt)
user.password_hash = hashed.decode('us-ascii') user.password_hash = hashed.decode('us-ascii')
if reset: if reset:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment