Skip to content

Commit 5567ecc

Browse files
committed
Fix bcrypt hashing failure for passwords longer than 72 bytes
1 parent f7a178a commit 5567ecc

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

proton/session/srp/util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def bcrypt_b64_encode(s): # The joy of bcrypt
3737

3838

3939
def hash_password_3(hash_class, password, salt, modulus):
40+
if len(password) > 72:
41+
password = password[:72]
4042
salt = (salt + b"proton")[:16]
4143
salt = bcrypt_b64_encode(salt)[:22]
4244
hashed = bcrypt.hashpw(password, b"$2y$10$" + salt)

0 commit comments

Comments
 (0)