summaryrefslogtreecommitdiffstats
path: root/Lib/hashlib.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2020-05-16 20:27:06 (GMT)
committerGitHub <noreply@github.com>2020-05-16 20:27:06 (GMT)
commitd5b3f6b7f9fc74438009af63f1de01bd77be9385 (patch)
tree32fed153b988a3dbb9c691ba924d989de5d17578 /Lib/hashlib.py
parentb17e49e0def23238b9e7f48c8a02e2d7bbf1f653 (diff)
downloadcpython-d5b3f6b7f9fc74438009af63f1de01bd77be9385.zip
cpython-d5b3f6b7f9fc74438009af63f1de01bd77be9385.tar.gz
cpython-d5b3f6b7f9fc74438009af63f1de01bd77be9385.tar.bz2
bpo-37630: Use SHA3 and SHAKE XOF from OpenSSL (GH-16049)
OpenSSL 1.1.1 comes with SHA3 and SHAKE builtin. Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: @tiran
Diffstat (limited to 'Lib/hashlib.py')
-rw-r--r--Lib/hashlib.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/hashlib.py b/Lib/hashlib.py
index 56873b7..0f81de0 100644
--- a/Lib/hashlib.py
+++ b/Lib/hashlib.py
@@ -71,8 +71,6 @@ __all__ = __always_supported + ('new', 'algorithms_guaranteed',
__builtin_constructor_cache = {}
__block_openssl_constructor = {
- 'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512',
- 'shake_128', 'shake_256',
'blake2b', 'blake2s',
}
@@ -125,6 +123,8 @@ def __get_openssl_constructor(name):
# Prefer our blake2 and sha3 implementation.
return __get_builtin_constructor(name)
try:
+ # MD5, SHA1, and SHA2 are in all supported OpenSSL versions
+ # SHA3/shake are available in OpenSSL 1.1.1+
f = getattr(_hashlib, 'openssl_' + name)
# Allow the C module to raise ValueError. The function will be
# defined but the hash not actually available thanks to OpenSSL.