Added a test for pbkdf2()'s default digest algorithm.

This commit is contained in:
Mads Jensen 2017-09-27 16:36:26 +02:00 committed by Tim Graham
parent c7e9e22695
commit 8ddbe01760
1 changed files with 4 additions and 0 deletions

View File

@ -140,3 +140,7 @@ class TestUtilsCryptoPBKDF2(unittest.TestCase):
result = pbkdf2(**vector['args']) result = pbkdf2(**vector['args'])
self.assertEqual(binascii.hexlify(result).decode('ascii'), self.assertEqual(binascii.hexlify(result).decode('ascii'),
vector['result']) vector['result'])
def test_default_hmac_alg(self):
kwargs = {'password': b'password', 'salt': b'salt', 'iterations': 1, 'dklen': 20}
self.assertEqual(pbkdf2(**kwargs), hashlib.pbkdf2_hmac(hash_name=hashlib.sha256().name, **kwargs))