|
70 | 70 |
|
71 | 71 | __builtin_constructor_cache = {}
|
72 | 72 |
|
| 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. |
73 | 78 | __block_openssl_constructor = {
|
74 | 79 | 'blake2b', 'blake2s',
|
75 | 80 | }
|
@@ -120,7 +125,7 @@ def __get_builtin_constructor(name):
|
120 | 125 |
|
121 | 126 | def __get_openssl_constructor(name):
|
122 | 127 | if name in __block_openssl_constructor:
|
123 |
| - # Prefer our blake2 and sha3 implementation. |
| 128 | + # Prefer our builtin blake2 implementation. |
124 | 129 | return __get_builtin_constructor(name)
|
125 | 130 | try:
|
126 | 131 | # MD5, SHA1, and SHA2 are in all supported OpenSSL versions
|
@@ -149,10 +154,7 @@ def __hash_new(name, data=b'', **kwargs):
|
149 | 154 | optionally initialized with data (which must be a bytes-like object).
|
150 | 155 | """
|
151 | 156 | 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. |
156 | 158 | return __get_builtin_constructor(name)(data, **kwargs)
|
157 | 159 | try:
|
158 | 160 | return _hashlib.new(name, data, **kwargs)
|
|
0 commit comments