From 755375bb7d866a01e19153f5809772f4474eb94d Mon Sep 17 00:00:00 2001 From: Dwayne Litzenberger Date: Sat, 16 Feb 2013 16:06:32 -0800 Subject: 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. --- pct-speedtest.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'pct-speedtest.py') diff --git a/pct-speedtest.py b/pct-speedtest.py index fe52a55..eb2778f 100644 --- a/pct-speedtest.py +++ b/pct-speedtest.py @@ -32,9 +32,14 @@ from Crypto.Cipher import AES, ARC2, ARC4, Blowfish, CAST, DES3, DES, XOR from Crypto.Hash import HMAC, MD2, MD4, MD5, SHA, SHA224, SHA256, SHA384, SHA512 from Crypto.Random import get_random_bytes try: - from Crypto.Hash import RIPEMD -except ImportError: # Some builds of PyCrypto don't have the RIPEMD module - RIPEMD = None + from Crypto.Hash import RIPEMD160 +except ImportError: + # Maybe it's called RIPEMD + try: + from Crypto.Hash import RIPEMD as RIPEMD160 + except ImportError: + # Some builds of PyCrypto don't have the RIPEMD module + RIPEMD160 = None try: import hashlib @@ -222,8 +227,8 @@ class Benchmark: ("SHA384", SHA384), ("SHA512", SHA512), ] - if RIPEMD is not None: - hash_specs += [("RIPEMD", RIPEMD)] + if RIPEMD160 is not None: + hash_specs += [("RIPEMD160", RIPEMD160)] hashlib_specs = [] if hashlib is not None: -- cgit v1.2.1