Bypass __get_openssl_constructor() and always use our own blake2 implementation
authorChristian Heimes <christian@python.org>
Wed, 7 Sep 2016 00:35:13 +0000 (02:35 +0200)
committerChristian Heimes <christian@python.org>
Wed, 7 Sep 2016 00:35:13 +0000 (02:35 +0200)
Lib/hashlib.py

index 40ccdec351e2014a2041cc9d5d2e2a8fd0642837..2d5e92ea3387ef5c3913eb94278081179f8fdc89 100644 (file)
@@ -101,6 +101,9 @@ def __get_builtin_constructor(name):
 
 
 def __get_openssl_constructor(name):
+    if name in {'blake2b', 'blake2s'}:
+        # Prefer our blake2 implementation.
+        return __get_builtin_constructor(name)
     try:
         f = getattr(_hashlib, 'openssl_' + name)
         # Allow the C module to raise ValueError.  The function will be