summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_hmac.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-07-10 13:35:52 (GMT)
committerGuido van Rossum <guido@python.org>2007-07-10 13:35:52 (GMT)
commit3f42908051dbb4213f213c52fc9ab4a457714327 (patch)
tree40ae343a5441ccb18498b089d59fad16203d6505 /Lib/test/test_hmac.py
parentf895307a945d30fd5207f4c512ac2c0b5f59b335 (diff)
downloadcpython-3f42908051dbb4213f213c52fc9ab4a457714327.zip
cpython-3f42908051dbb4213f213c52fc9ab4a457714327.tar.gz
cpython-3f42908051dbb4213f213c52fc9ab4a457714327.tar.bz2
Make hmac use bytes. Make test_hmac pass.
Diffstat (limited to 'Lib/test/test_hmac.py')
-rw-r--r--Lib/test/test_hmac.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py
index d28490d..b453f04 100644
--- a/Lib/test/test_hmac.py
+++ b/Lib/test/test_hmac.py
@@ -12,31 +12,31 @@ class TestVectorsTestCase(unittest.TestCase):
h = hmac.HMAC(key, data)
self.assertEqual(h.hexdigest().upper(), digest.upper())
- md5test(chr(0x0b) * 16,
- "Hi There",
+ md5test(b"\x0b" * 16,
+ b"Hi There",
"9294727A3638BB1C13F48EF8158BFC9D")
- md5test("Jefe",
- "what do ya want for nothing?",
+ md5test(b"Jefe",
+ b"what do ya want for nothing?",
"750c783e6ab0b503eaa86e310a5db738")
- md5test(chr(0xAA)*16,
- chr(0xDD)*50,
+ md5test(b"\xaa" * 16,
+ b"\xdd" * 50,
"56be34521d144c88dbb8c733f0e8b3f6")
md5test("".join([chr(i) for i in range(1, 26)]),
- chr(0xCD) * 50,
+ b"\xcd" * 50,
"697eaf0aca3a3aea3a75164746ffaa79")
md5test(chr(0x0C) * 16,
"Test With Truncation",
"56461ef2342edc00f9bab995690efd4c")
- md5test(chr(0xAA) * 80,
+ md5test(b"\xaa" * 80,
"Test Using Larger Than Block-Size Key - Hash Key First",
"6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd")
- md5test(chr(0xAA) * 80,
+ md5test(b"\xaa" * 80,
("Test Using Larger Than Block-Size Key "
"and Larger Than One Block-Size Data"),
"6f630fad67cda0ee1fb1f562db3aa53e")
@@ -46,33 +46,33 @@ class TestVectorsTestCase(unittest.TestCase):
h = hmac.HMAC(key, data, digestmod=sha1)
self.assertEqual(h.hexdigest().upper(), digest.upper())
- shatest(chr(0x0b) * 20,
- "Hi There",
+ shatest(b"\x0b" * 20,
+ b"Hi There",
"b617318655057264e28bc0b6fb378c8ef146be00")
- shatest("Jefe",
- "what do ya want for nothing?",
+ shatest(b"Jefe",
+ b"what do ya want for nothing?",
"effcdf6ae5eb2fa2d27416d5f184df9c259a7c79")
- shatest(chr(0xAA)*20,
- chr(0xDD)*50,
+ shatest(b"\xAA" * 20,
+ b"\xDD" * 50,
"125d7342b9ac11cd91a39af48aa17b4f63f175d3")
- shatest("".join([chr(i) for i in range(1, 26)]),
- chr(0xCD) * 50,
+ shatest(bytes(range(1, 26)),
+ b"\xCD" * 50,
"4c9007f4026250c6bc8414f9bf50c86c2d7235da")
shatest(chr(0x0C) * 20,
"Test With Truncation",
"4c1a03424b55e07fe7f27be1d58bb9324a9a5a04")
- shatest(chr(0xAA) * 80,
- "Test Using Larger Than Block-Size Key - Hash Key First",
+ shatest(b"\xAA" * 80,
+ b"Test Using Larger Than Block-Size Key - Hash Key First",
"aa4ae5e15272d00e95705637ce8a3b55ed402112")
- shatest(chr(0xAA) * 80,
- ("Test Using Larger Than Block-Size Key "
- "and Larger Than One Block-Size Data"),
+ shatest(b"\xAA" * 80,
+ (b"Test Using Larger Than Block-Size Key "
+ b"and Larger Than One Block-Size Data"),
"e8e99d0f45237d786d6bbaa7965c7808bbff1a91")