summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Apolloner <florian@apolloner.eu>2020-12-27 17:41:33 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-12-28 11:02:03 +0100
commit1b7086b2ea4c06d9c4b9233c166a16fe4390c877 (patch)
treeed6e92d3a0cd630b3579fc25e83cd0eb33947a23
parentb11ec9a69ef626bd7aa22879145e9d74ea38a814 (diff)
Refs #31358 -- Simplified Argon2PasswordHasher.must_update() by using decode().
-rw-r--r--django/contrib/auth/hashers.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py
index bc56b705ee..99d3d5ff6a 100644
--- a/django/contrib/auth/hashers.py
+++ b/django/contrib/auth/hashers.py
@@ -354,6 +354,7 @@ class Argon2PasswordHasher(BasePasswordHasher):
'time_cost': params.time_cost,
'variety': variety,
'version': params.version,
+ 'params': params,
}
def verify(self, password, encoded):
@@ -379,10 +380,7 @@ class Argon2PasswordHasher(BasePasswordHasher):
}
def must_update(self, encoded):
- algorithm, rest = encoded.split('$', 1)
- assert algorithm == self.algorithm
- argon2 = self._load_library()
- current_params = argon2.extract_parameters('$' + rest)
+ current_params = self.decode(encoded)['params']
new_params = self.params()
# Set salt_len to the salt_len of the current parameters because salt
# is explicitly passed to argon2.