summaryrefslogtreecommitdiff
path: root/passlib
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2020-05-02 13:48:41 -0400
committerEli Collins <elic@assurancetechnologies.com>2020-05-02 13:48:41 -0400
commit61f4f3ba5d520dc5b35415be7c9dae49911429db (patch)
tree04383a18ef4e609bf7b80ae5cf426e42d3cdaeea /passlib
parentad36df92db4464e0a08e2fc2bc8a1ca9485858b7 (diff)
downloadpasslib-61f4f3ba5d520dc5b35415be7c9dae49911429db.tar.gz
passlib.crypto.digests: cleaned up internal digests table;
removing some aliases that weren't needed anymore, and adding some new ones.
Diffstat (limited to 'passlib')
-rw-r--r--passlib/crypto/digest.py16
-rw-r--r--passlib/tests/test_crypto_digest.py6
2 files changed, 16 insertions, 6 deletions
diff --git a/passlib/crypto/digest.py b/passlib/crypto/digest.py
index d26f892..25f1be4 100644
--- a/passlib/crypto/digest.py
+++ b/passlib/crypto/digest.py
@@ -68,9 +68,11 @@ MAX_UINT64 = (1 << 64) - 1
_known_hash_names = [
# format: (hashlib/ssl name, iana name or standin, other known aliases ...)
+ #----------------------------------------------------
# hashes with official IANA-assigned names
# (as of 2012-03 - http://www.iana.org/assignments/hash-function-text-names)
- ("md2", "md2"),
+ #----------------------------------------------------
+ ("md2", "md2"), # NOTE: openssl dropped md2 support in v1.0.0
("md5", "md5"),
("sha1", "sha-1"),
("sha224", "sha-224", "sha2-224"),
@@ -80,12 +82,18 @@ _known_hash_names = [
# TODO: add sha3 to this table.
+ #----------------------------------------------------
# hashlib/ssl-supported hashes without official IANA names,
# (hopefully-) compatible stand-ins have been chosen.
+ #----------------------------------------------------
+
+ ("blake2b", "blake-2b"),
+ ("blake2s", "blake-2s"),
("md4", "md4"),
- ("sha", "sha-0", "sha0"),
- ("ripemd", "ripemd"),
- ("ripemd160", "ripemd-160"),
+ # NOTE: there was an older "ripemd" and "ripemd-128",
+ # but python 2.7+ resolves "ripemd" -> "ripemd160",
+ # so treating "ripemd" as alias here.
+ ("ripemd160", "ripemd-160", "ripemd"),
]
#: cache of hash info instances used by lookup_hash()
diff --git a/passlib/tests/test_crypto_digest.py b/passlib/tests/test_crypto_digest.py
index 65b4a4d..5070a40 100644
--- a/passlib/tests/test_crypto_digest.py
+++ b/passlib/tests/test_crypto_digest.py
@@ -30,8 +30,10 @@ class HashInfoTest(TestCase):
("md5", "md5", "SCRAM-MD5-PLUS", "MD-5"),
("sha1", "sha-1", "SCRAM-SHA-1", "SHA1"),
("sha256", "sha-256", "SHA_256", "sha2-256"),
- ("ripemd", "ripemd", "SCRAM-RIPEMD", "RIPEMD"),
- ("ripemd160", "ripemd-160", "SCRAM-RIPEMD-160", "RIPEmd160"),
+ ("ripemd160", "ripemd-160", "SCRAM-RIPEMD-160", "RIPEmd160",
+ # NOTE: there was an older "RIPEMD" & "RIPEMD-128", but python treates "RIPEMD"
+ # as alias for "RIPEMD-160"
+ "ripemd", "SCRAM-RIPEMD"),
# fake hashes (to check if fallback normalization behaves sanely)
("sha4_256", "sha4-256", "SHA4-256", "SHA-4-256"),