def test_argon2id_static(self):
     # re-generate from the official argon2 tools:
     # echo -n "p4ssw0rd" | argon2 '1234567890abcdef' -id -t 32 -m 9 -p 1 -l 32
     expected = binascii.unhexlify('ee4a8acf9d5958354fb79a95ae20692d05e42591ba49fae85eb6700e8b0ed293')
     raw_hash = auth._hash_argon2id13_secret(
         b'p4ssw0rd',
         binascii.b2a_base64(b'1234567890abcdef'),  # ours takes base64-encoded salt
         32,  # this is WAY TOO SMALL; for production, use 4096 or higher
         512,  # note that the argon2 utility takes a "power of 2", so "-m 9" above == 512
     )
     decoded_hash = binascii.a2b_base64(raw_hash + b'==\n')
     self.assertEqual(expected, decoded_hash)
Exemplo n.º 2
0
 def test_argon2id_static(self):
     # re-generate from the official argon2 tools:
     # echo -n "p4ssw0rd" | argon2 '1234567890abcdef' -id -t 32 -m 9 -p 1 -l 32
     expected = binascii.unhexlify('ee4a8acf9d5958354fb79a95ae20692d05e42591ba49fae85eb6700e8b0ed293')
     raw_hash = auth._hash_argon2id13_secret(
         b'p4ssw0rd',
         binascii.b2a_base64(b'1234567890abcdef'),  # ours takes base64-encoded salt
         32,  # this is WAY TOO SMALL; for production, use 4096 or higher
         512,  # note that the argon2 utility takes a "power of 2", so "-m 9" above == 512
     )
     decoded_hash = binascii.a2b_base64(raw_hash + b'==\n')
     self.assertEqual(expected, decoded_hash)