From a3e9e7a6ff08a3712bbbc1ec1acfe1184d3e6060 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Wed, 29 Sep 2021 21:57:13 +0200
Subject: [PATCH] =?UTF-8?q?He=C5=A1ovac=C3=AD=20funkci=20na=20hesla=20sn?=
 =?UTF-8?q?=C3=AD=C5=BEen=20po=C4=8Det=20iterac=C3=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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.
---
 mo/users.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mo/users.py b/mo/users.py
index 251fb3c4..6bbe2d24 100644
--- a/mo/users.py
+++ b/mo/users.py
@@ -184,7 +184,7 @@ def validate_password(passwd: str) -> bool:
 
 
 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)
     user.password_hash = hashed.decode('us-ascii')
     if reset:
-- 
GitLab