diff options
author | Erik Johnston <erikj@jki.re> | 2016-07-05 11:26:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-05 11:26:22 +0100 |
commit | e34cb5e7dc0c4858e955eace999499fcc46a404b (patch) | |
tree | dea95524ba78e288645ecc49571e5df43f2f7765 /synapse/handlers | |
parent | Merge pull request #905 from KentShikama/add-password-hash (diff) | |
parent | Remove default password pepper string (diff) | |
download | synapse-e34cb5e7dc0c4858e955eace999499fcc46a404b.tar.xz |
Merge pull request #907 from KentShikama/pepper
Add pepper to password hashing
Diffstat (limited to '')
-rw-r--r-- | synapse/handlers/auth.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py index 968095c141..e259213a36 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py @@ -750,7 +750,8 @@ class AuthHandler(BaseHandler): Returns: Hashed password (str). """ - return bcrypt.hashpw(password, bcrypt.gensalt(self.bcrypt_rounds)) + return bcrypt.hashpw(password + self.hs.config.password_pepper, + bcrypt.gensalt(self.bcrypt_rounds)) def validate_hash(self, password, stored_hash): """Validates that self.hash(password) == stored_hash. @@ -763,6 +764,7 @@ class AuthHandler(BaseHandler): Whether self.hash(password) == stored_hash (bool). """ if stored_hash: - return bcrypt.hashpw(password, stored_hash.encode('utf-8')) == stored_hash + return bcrypt.hashpw(password + self.hs.config.password_pepper, + stored_hash.encode('utf-8')) == stored_hash else: return False |