Added test for old Argon2i hashes with version attribute.

This commit is contained in:
Florian Apolloner 2020-06-17 07:52:31 +02:00 committed by Mariusz Felisiak
parent 78c811334c
commit ee49cf4f35
1 changed files with 6 additions and 0 deletions

View File

@ -514,6 +514,12 @@ class TestUtilsHashPassArgon2(SimpleTestCase):
) )
self.assertTrue(check_password('secret', encoded)) self.assertTrue(check_password('secret', encoded))
self.assertFalse(check_password('wrong', encoded)) self.assertFalse(check_password('wrong', encoded))
# Old hashes with version attribute.
encoded = (
'argon2$argon2i$v=19$m=8,t=1,p=1$c2FsdHNhbHQ$YC9+jJCrQhs5R6db7LlN8Q'
)
self.assertIs(check_password('secret', encoded), True)
self.assertIs(check_password('wrong', encoded), False)
def test_argon2_upgrade(self): def test_argon2_upgrade(self):
self._test_argon2_upgrade('time_cost', 'time cost', 1) self._test_argon2_upgrade('time_cost', 'time cost', 1)