diff options
author | Christian Heimes <christian@cheimes.de> | 2013-11-20 16:23:06 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-11-20 16:23:06 (GMT) |
commit | 634919a9fa1fffe3d36b13b4248f99508b5999ed (patch) | |
tree | b60c9ca7e04ad97e11385712b3405fc9b42d7803 /Lib/test/test_pep247.py | |
parent | 7f48396cb5d19a40f571b0aec4916612f117a13d (diff) | |
download | cpython-634919a9fa1fffe3d36b13b4248f99508b5999ed.zip cpython-634919a9fa1fffe3d36b13b4248f99508b5999ed.tar.gz cpython-634919a9fa1fffe3d36b13b4248f99508b5999ed.tar.bz2 |
Issue #17276: MD5 as default digestmod for HMAC is deprecated. The HMAC
module supports digestmod names, e.g. hmac.HMAC('sha1').
Diffstat (limited to 'Lib/test/test_pep247.py')
-rw-r--r-- | Lib/test/test_pep247.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/test_pep247.py b/Lib/test/test_pep247.py index 7f10472..b85a26a 100644 --- a/Lib/test/test_pep247.py +++ b/Lib/test/test_pep247.py @@ -15,12 +15,14 @@ class Pep247Test(unittest.TestCase): self.assertTrue(module.digest_size is None or module.digest_size > 0) self.check_object(module.new, module.digest_size, key) - def check_object(self, cls, digest_size, key): + def check_object(self, cls, digest_size, key, digestmod=None): if key is not None: - obj1 = cls(key) - obj2 = cls(key, b'string') - h1 = cls(key, b'string').digest() - obj3 = cls(key) + if digestmod is None: + digestmod = md5 + obj1 = cls(key, digestmod=digestmod) + obj2 = cls(key, b'string', digestmod=digestmod) + h1 = cls(key, b'string', digestmod=digestmod).digest() + obj3 = cls(key, digestmod=digestmod) obj3.update(b'string') h2 = obj3.digest() else: |