mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:46:06 -04:00
Add config for how many bcrypt rounds to use for password hashes
By default we leave it at the default value of 12. But now we can reduce it for preparing users for loadtests or running integration tests.
This commit is contained in:
parent
a059760954
commit
f2f031fd57
2 changed files with 8 additions and 1 deletions
|
@ -44,6 +44,7 @@ class AuthHandler(BaseHandler):
|
|||
LoginType.EMAIL_IDENTITY: self._check_email_identity,
|
||||
LoginType.DUMMY: self._check_dummy_auth,
|
||||
}
|
||||
self.bcrypt_rounds = hs.config.bcrypt_rounds
|
||||
self.sessions = {}
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
@ -432,7 +433,7 @@ class AuthHandler(BaseHandler):
|
|||
Returns:
|
||||
Hashed password (str).
|
||||
"""
|
||||
return bcrypt.hashpw(password, bcrypt.gensalt())
|
||||
return bcrypt.hashpw(password, bcrypt.gensalt(self.bcrypt_rounds))
|
||||
|
||||
def validate_hash(self, password, stored_hash):
|
||||
"""Validates that self.hash(password) == stored_hash.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue