Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a0fe7b

Browse files
authored
Improve blake2 comment for Victor (GH-20981)
Signed-off-by: Christian Heimes <[email protected]> Automerge-Triggered-By: @tiran
1 parent 66a65ba commit 8a0fe7b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Lib/hashlib.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@
7070

7171
__builtin_constructor_cache = {}
7272

73+
# Prefer our blake2 implementation
74+
# OpenSSL 1.1.0 comes with a limited implementation of blake2b/s. The OpenSSL
75+
# implementations neither support keyed blake2 (blake2 MAC) nor advanced
76+
# features like salt, personalization, or tree hashing. OpenSSL hash-only
77+
# variants are available as 'blake2b512' and 'blake2s256', though.
7378
__block_openssl_constructor = {
7479
'blake2b', 'blake2s',
7580
}
@@ -120,7 +125,7 @@ def __get_builtin_constructor(name):
120125

121126
def __get_openssl_constructor(name):
122127
if name in __block_openssl_constructor:
123-
# Prefer our blake2 and sha3 implementation.
128+
# Prefer our builtin blake2 implementation.
124129
return __get_builtin_constructor(name)
125130
try:
126131
# MD5, SHA1, and SHA2 are in all supported OpenSSL versions
@@ -149,10 +154,7 @@ def __hash_new(name, data=b'', **kwargs):
149154
optionally initialized with data (which must be a bytes-like object).
150155
"""
151156
if name in __block_openssl_constructor:
152-
# Prefer our blake2 and sha3 implementation
153-
# OpenSSL 1.1.0 comes with a limited implementation of blake2b/s.
154-
# It does neither support keyed blake2 nor advanced features like
155-
# salt, personal, tree hashing or SSE.
157+
# Prefer our builtin blake2 implementation.
156158
return __get_builtin_constructor(name)(data, **kwargs)
157159
try:
158160
return _hashlib.new(name, data, **kwargs)

0 commit comments

Comments
 (0)