summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_hmac.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2005-08-21 18:45:59 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2005-08-21 18:45:59 (GMT)
commitf21a5f773964d34c7b6deb7e3d753fae2b9c70e2 (patch)
treeba3b66cea11da1d8e930555aa5a10f775a285d84 /Lib/test/test_hmac.py
parent33a5f2af59ddcf3f1b0447a8dbd0576fd78de303 (diff)
downloadcpython-f21a5f773964d34c7b6deb7e3d753fae2b9c70e2.zip
cpython-f21a5f773964d34c7b6deb7e3d753fae2b9c70e2.tar.gz
cpython-f21a5f773964d34c7b6deb7e3d753fae2b9c70e2.tar.bz2
[ sf.net patch # 1121611 ]
A new hashlib module to replace the md5 and sha modules. It adds support for additional secure hashes such as SHA-256 and SHA-512. The hashlib module uses OpenSSL for fast platform optimized implementations of algorithms when available. The old md5 and sha modules still exist as wrappers around hashlib to preserve backwards compatibility.
Diffstat (limited to 'Lib/test/test_hmac.py')
-rw-r--r--Lib/test/test_hmac.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py
index b365794..9d094d2 100644
--- a/Lib/test/test_hmac.py
+++ b/Lib/test/test_hmac.py
@@ -105,9 +105,10 @@ class SanityTestCase(unittest.TestCase):
def test_default_is_md5(self):
# Testing if HMAC defaults to MD5 algorithm.
- import md5
+ # NOTE: this whitebox test depends on the hmac class internals
+ import hashlib
h = hmac.HMAC("key")
- self.failUnless(h.digestmod == md5)
+ self.failUnless(h.digest_cons == hashlib.md5)
def test_exercise_all_methods(self):
# Exercising all methods once.
@@ -127,8 +128,8 @@ class CopyTestCase(unittest.TestCase):
# Testing if attributes are of same type.
h1 = hmac.HMAC("key")
h2 = h1.copy()
- self.failUnless(h1.digestmod == h2.digestmod,
- "Modules don't match.")
+ self.failUnless(h1.digest_cons == h2.digest_cons,
+ "digest constructors don't match.")
self.failUnless(type(h1.inner) == type(h2.inner),
"Types of inner don't match.")
self.failUnless(type(h1.outer) == type(h2.outer),