diff options
author | Dwayne Litzenberger <dlitz@dlitz.net> | 2013-02-16 16:06:32 -0800 |
---|---|---|
committer | Dwayne Litzenberger <dlitz@dlitz.net> | 2013-02-16 16:20:23 -0800 |
commit | 755375bb7d866a01e19153f5809772f4474eb94d (patch) | |
tree | b8abee5c8e7c529330cfe371a318075df2a86b28 /lib/Crypto/SelfTest | |
parent | 7f5b9415346ea5849e8f6becbafcef8a48cf1b8f (diff) | |
download | pycrypto-755375bb7d866a01e19153f5809772f4474eb94d.tar.gz |
Hash: Rename SHA->SHA1 and RIPEMD->RIPEMD160 (1/2)
These algorithm names were confusing, because there are actually
algorithms called "SHA" (a.k.a. SHA-0) and "RIPEMD" (the original
version).
This commit just renames the modules, with no backward-compatibility
support.
Diffstat (limited to 'lib/Crypto/SelfTest')
-rw-r--r-- | lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py | 4 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Hash/__init__.py | 14 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Hash/test_HMAC.py | 2 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Hash/test_RIPEMD160.py (renamed from lib/Crypto/SelfTest/Hash/test_RIPEMD.py) | 8 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Hash/test_SHA1.py (renamed from lib/Crypto/SelfTest/Hash/test_SHA.py) | 6 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Protocol/test_KDF.py | 2 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Signature/test_pkcs1_15.py | 6 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py | 16 |
8 files changed, 29 insertions, 29 deletions
diff --git a/lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py b/lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py index 7ca5c15..86c38a3 100644 --- a/lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py +++ b/lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py @@ -31,7 +31,7 @@ from Crypto.SelfTest.st_common import list_test_cases, a2b_hex, b2a_hex from Crypto.Util.py3compat import * from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP as PKCS -from Crypto.Hash import MD2,MD5,SHA as SHA1,SHA256,RIPEMD +from Crypto.Hash import MD2,MD5,SHA1,SHA256,RIPEMD160 from Crypto import Random def rws(t): @@ -327,7 +327,7 @@ class PKCS1_OAEP_Tests(unittest.TestCase): asked += N return self.rng(N) # Verify that OAEP is friendly to all hashes - for hashmod in (MD2,MD5,SHA1,SHA256,RIPEMD): + for hashmod in (MD2,MD5,SHA1,SHA256,RIPEMD160): # Verify that encrypt() asks for as many random bytes # as the hash output size asked = 0 diff --git a/lib/Crypto/SelfTest/Hash/__init__.py b/lib/Crypto/SelfTest/Hash/__init__.py index bb19f9b..d6c8e57 100644 --- a/lib/Crypto/SelfTest/Hash/__init__.py +++ b/lib/Crypto/SelfTest/Hash/__init__.py @@ -28,13 +28,13 @@ __revision__ = "$Id$" def get_tests(config={}): tests = [] - from Crypto.SelfTest.Hash import test_HMAC; tests += test_HMAC.get_tests(config=config) - from Crypto.SelfTest.Hash import test_MD2; tests += test_MD2.get_tests(config=config) - from Crypto.SelfTest.Hash import test_MD4; tests += test_MD4.get_tests(config=config) - from Crypto.SelfTest.Hash import test_MD5; tests += test_MD5.get_tests(config=config) - from Crypto.SelfTest.Hash import test_RIPEMD; tests += test_RIPEMD.get_tests(config=config) - from Crypto.SelfTest.Hash import test_SHA; tests += test_SHA.get_tests(config=config) - from Crypto.SelfTest.Hash import test_SHA256; tests += test_SHA256.get_tests(config=config) + from Crypto.SelfTest.Hash import test_HMAC; tests += test_HMAC.get_tests(config=config) + from Crypto.SelfTest.Hash import test_MD2; tests += test_MD2.get_tests(config=config) + from Crypto.SelfTest.Hash import test_MD4; tests += test_MD4.get_tests(config=config) + from Crypto.SelfTest.Hash import test_MD5; tests += test_MD5.get_tests(config=config) + from Crypto.SelfTest.Hash import test_RIPEMD160; tests += test_RIPEMD160.get_tests(config=config) + from Crypto.SelfTest.Hash import test_SHA1; tests += test_SHA1.get_tests(config=config) + from Crypto.SelfTest.Hash import test_SHA256; tests += test_SHA256.get_tests(config=config) try: from Crypto.SelfTest.Hash import test_SHA224; tests += test_SHA224.get_tests(config=config) from Crypto.SelfTest.Hash import test_SHA384; tests += test_SHA384.get_tests(config=config) diff --git a/lib/Crypto/SelfTest/Hash/test_HMAC.py b/lib/Crypto/SelfTest/Hash/test_HMAC.py index c01c97b..85bdf47 100644 --- a/lib/Crypto/SelfTest/Hash/test_HMAC.py +++ b/lib/Crypto/SelfTest/Hash/test_HMAC.py @@ -203,7 +203,7 @@ hashlib_test_data = [ def get_tests(config={}): global test_data - from Crypto.Hash import HMAC, MD5, SHA as SHA1, SHA256 + from Crypto.Hash import HMAC, MD5, SHA1, SHA256 from common import make_mac_tests hashmods = dict(MD5=MD5, SHA1=SHA1, SHA256=SHA256, default=None) try: diff --git a/lib/Crypto/SelfTest/Hash/test_RIPEMD.py b/lib/Crypto/SelfTest/Hash/test_RIPEMD160.py index 6673a93..d476249 100644 --- a/lib/Crypto/SelfTest/Hash/test_RIPEMD.py +++ b/lib/Crypto/SelfTest/Hash/test_RIPEMD160.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# SelfTest/Hash/test_RIPEMD.py: Self-test for the RIPEMD-160 hash function +# SelfTest/Hash/test_RIPEMD160.py: Self-test for the RIPEMD-160 hash function # # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net> # @@ -22,7 +22,7 @@ # SOFTWARE. # =================================================================== -#"""Self-test suite for Crypto.Hash.RIPEMD""" +#"""Self-test suite for Crypto.Hash.RIPEMD160""" __revision__ = "$Id$" @@ -59,9 +59,9 @@ test_data = [ ] def get_tests(config={}): - from Crypto.Hash import RIPEMD + from Crypto.Hash import RIPEMD160 from common import make_hash_tests - return make_hash_tests(RIPEMD, "RIPEMD", test_data, + return make_hash_tests(RIPEMD160, "RIPEMD160", test_data, digest_size=20, oid="\x06\x05\x2b\x24\x03\02\x01") diff --git a/lib/Crypto/SelfTest/Hash/test_SHA.py b/lib/Crypto/SelfTest/Hash/test_SHA1.py index 7d72e77..83bd6d2 100644 --- a/lib/Crypto/SelfTest/Hash/test_SHA.py +++ b/lib/Crypto/SelfTest/Hash/test_SHA1.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# SelfTest/Hash/SHA.py: Self-test for the SHA-1 hash function +# SelfTest/Hash/SHA1.py: Self-test for the SHA-1 hash function # # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net> # @@ -50,9 +50,9 @@ test_data = [ ] def get_tests(config={}): - from Crypto.Hash import SHA + from Crypto.Hash import SHA1 from common import make_hash_tests - return make_hash_tests(SHA, "SHA", test_data, + return make_hash_tests(SHA1, "SHA1", test_data, digest_size=20, oid="\x06\x05\x2B\x0E\x03\x02\x1A") diff --git a/lib/Crypto/SelfTest/Protocol/test_KDF.py b/lib/Crypto/SelfTest/Protocol/test_KDF.py index 119836b..f0a44d1 100644 --- a/lib/Crypto/SelfTest/Protocol/test_KDF.py +++ b/lib/Crypto/SelfTest/Protocol/test_KDF.py @@ -26,7 +26,7 @@ import unittest from binascii import unhexlify from Crypto.SelfTest.st_common import list_test_cases -from Crypto.Hash import SHA as SHA1,HMAC +from Crypto.Hash import SHA1, HMAC from Crypto.Protocol.KDF import * diff --git a/lib/Crypto/SelfTest/Signature/test_pkcs1_15.py b/lib/Crypto/SelfTest/Signature/test_pkcs1_15.py index bc36696..d56ba95 100644 --- a/lib/Crypto/SelfTest/Signature/test_pkcs1_15.py +++ b/lib/Crypto/SelfTest/Signature/test_pkcs1_15.py @@ -123,7 +123,7 @@ class PKCS1_15_Tests(unittest.TestCase): '''4a700a16432a291a3194646952687d5316458b8b86fb0a25aa30e0dcecdb 442676759ac63d56ec1499c3ae4c0013c2053cabd5b5804848994541ac16 fa243a4d''', - SHA + SHA1 ), # @@ -146,7 +146,7 @@ class PKCS1_15_Tests(unittest.TestCase): A9D20970C54E6651070B0144D43844C899320DD8FA7819F7EBC6A7715287332E C8675C136183B3F8A1F81EF969418267130A756FDBB2C71D9A667446E34E0EAD 9CF31BFB66F816F319D0B7E430A5F2891553986E003720261C7E9022C0D9F11F''', - SHA + SHA1 ) ) @@ -197,7 +197,7 @@ class PKCS1_15_Tests(unittest.TestCase): rng = Random.new().read key = RSA.generate(1024, rng) - for hashmod in (MD2,MD5,SHA,SHA224,SHA256,SHA384,SHA512,RIPEMD): + for hashmod in (MD2,MD5,SHA1,SHA224,SHA256,SHA384,SHA512,RIPEMD160): h = hashmod.new() h.update(b('blah blah blah')) diff --git a/lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py b/lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py index f5256a5..314d2b8 100644 --- a/lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py +++ b/lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py @@ -136,7 +136,7 @@ class PKCS1_PSS_Tests(unittest.TestCase): '''e3 b5 d5 d0 02 c1 bc e5 0c 2b 65 ef 88 a1 88 d8 3b ce 7e 61''', # Hash algorithm - SHA + SHA1 ), # @@ -192,7 +192,7 @@ class PKCS1_PSS_Tests(unittest.TestCase): '''de e9 59 c7 e0 64 11 36 14 20 ff 80 18 5e d5 7f 3e 67 76 af''', # Hash - SHA + SHA1 ), # @@ -238,7 +238,7 @@ class PKCS1_PSS_Tests(unittest.TestCase): '''ef 28 69 fa 40 c3 46 cb 18 3d ab 3d 7b ff c9 8f d5 6d f4 2d''', # Hash - SHA + SHA1 ), # @@ -285,7 +285,7 @@ class PKCS1_PSS_Tests(unittest.TestCase): # Salt '''57 bf 16 0b cb 02 bb 1d c7 28 0c f0 45 85 30 b7 d2 83 2f f7''', - SHA + SHA1 ), # @@ -339,7 +339,7 @@ class PKCS1_PSS_Tests(unittest.TestCase): # Salt '''1d 65 49 1d 79 c8 64 b3 73 00 9b e6 f6 f2 46 7b ac 4c 78 fa''', - SHA + SHA1 ) ) @@ -380,7 +380,7 @@ class PKCS1_PSS_Tests(unittest.TestCase): self.failUnless(result) def testSignVerify(self): - h = SHA.new() + h = SHA1.new() h.update(b('blah blah blah')) rng = Random.new().read @@ -394,7 +394,7 @@ class PKCS1_PSS_Tests(unittest.TestCase): return bchr(0x00)*maskLen # Verify that PSS is friendly to all ciphers - for hashmod in (MD2,MD5,SHA,SHA224,SHA256,SHA384,RIPEMD): + for hashmod in (MD2,MD5,SHA1,SHA224,SHA256,SHA384,RIPEMD160): h = hashmod.new() h.update(b('blah blah blah')) @@ -406,7 +406,7 @@ class PKCS1_PSS_Tests(unittest.TestCase): self.failUnless(signer.verify(h, s)) self.assertEqual(key.asked, h.digest_size) - h = SHA.new() + h = SHA1.new() h.update(b('blah blah blah')) # Verify that sign() uses a different salt length |