From 8ddbe01760310098c08063afb049486aed845342 Mon Sep 17 00:00:00 2001 From: Mads Jensen Date: Wed, 27 Sep 2017 16:36:26 +0200 Subject: [PATCH] Added a test for pbkdf2()'s default digest algorithm. --- tests/utils_tests/test_crypto.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/utils_tests/test_crypto.py b/tests/utils_tests/test_crypto.py index bd0c111ff3..8885112095 100644 --- a/tests/utils_tests/test_crypto.py +++ b/tests/utils_tests/test_crypto.py @@ -140,3 +140,7 @@ class TestUtilsCryptoPBKDF2(unittest.TestCase): result = pbkdf2(**vector['args']) self.assertEqual(binascii.hexlify(result).decode('ascii'), 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))