New submission from Christian Heimes <li...@cheimes.de>:
The hashlib module / PEP 452 and OpenSSL use slightly different conventions for hashing algorithm names. The old and common algorithms like md5 to sha512 use the same strings (all lower case, no dashes or underscores). But new algorithms like sha3_512, shake, sha512_256, and blake2 use different conventions. The inconsistency bloats the list of available algorithms. Also the builtin OpenSSL constructor does not support Python's preferred names. >>> import hashlib, _hashlib >>> sorted(hashlib.algorithms_available) ['blake2b', 'blake2b512', 'blake2s', 'blake2s256', 'md4', 'md5', 'md5-sha1', 'ripemd160', 'sha1', 'sha224', 'sha256', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512', 'sha384', 'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512', 'sha512', 'sha512-224', 'sha512-256', 'shake128', 'shake256', 'shake_128', 'shake_256', 'sm3', 'whirlpool'] >>> _hashlib.new("sha3_512") Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: unsupported hash type >>> _hashlib.new("sha3-512") <sha3-512 HASH object @ 0x7f1387890840> I propose to normalize names to Python standard names for HASH.name, repr, list of available algorithms, and for the new() constructor. ---------- assignee: christian.heimes components: Extension Modules messages: 352270 nosy: christian.heimes, gregory.p.smith priority: normal severity: normal status: open title: Normalize hashing algorithm names type: behavior versions: Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38153> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com