-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normalize hashing algorithm names #82334
Comments
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. |
as discussed, not pushing this back into 3.7 as we aren't hearing users call this a problem. |
Can this be closed? |
looks like it, thanks! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: