diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/auth/hashers.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py index 99d3d5ff6a..0e44614fcb 100644 --- a/django/contrib/auth/hashers.py +++ b/django/contrib/auth/hashers.py @@ -344,7 +344,10 @@ class Argon2PasswordHasher(BasePasswordHasher): algorithm, rest = encoded.split('$', 1) assert algorithm == self.algorithm params = argon2.extract_parameters('$' + rest) - variety, *_, salt, hash = rest.split('$') + variety, *_, b64salt, hash = rest.split('$') + # Add padding. + b64salt += '=' * (-len(b64salt) % 4) + salt = base64.b64decode(b64salt).decode('latin1') return { 'algorithm': algorithm, 'hash': hash, |
