Refs #31358 -- Simplified Argon2PasswordHasher.must_update() by using decode().
This commit is contained in:
parent
b11ec9a69e
commit
1b7086b2ea
|
@ -354,6 +354,7 @@ class Argon2PasswordHasher(BasePasswordHasher):
|
||||||
'time_cost': params.time_cost,
|
'time_cost': params.time_cost,
|
||||||
'variety': variety,
|
'variety': variety,
|
||||||
'version': params.version,
|
'version': params.version,
|
||||||
|
'params': params,
|
||||||
}
|
}
|
||||||
|
|
||||||
def verify(self, password, encoded):
|
def verify(self, password, encoded):
|
||||||
|
@ -379,10 +380,7 @@ class Argon2PasswordHasher(BasePasswordHasher):
|
||||||
}
|
}
|
||||||
|
|
||||||
def must_update(self, encoded):
|
def must_update(self, encoded):
|
||||||
algorithm, rest = encoded.split('$', 1)
|
current_params = self.decode(encoded)['params']
|
||||||
assert algorithm == self.algorithm
|
|
||||||
argon2 = self._load_library()
|
|
||||||
current_params = argon2.extract_parameters('$' + rest)
|
|
||||||
new_params = self.params()
|
new_params = self.params()
|
||||||
# Set salt_len to the salt_len of the current parameters because salt
|
# Set salt_len to the salt_len of the current parameters because salt
|
||||||
# is explicitly passed to argon2.
|
# is explicitly passed to argon2.
|
||||||
|
|
Loading…
Reference in New Issue