git: 9front

Download patch

ref: 3a80103d5fc88f5a548a213c95f3ae8eb2356adf
parent: aab02102a1374fd3176c654459f64fa0fe5a78b3
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Apr 12 22:21:03 EDT 2016

python: make hashlib.py fallback to openssl in case of old python binary

--- a/sys/lib/python/hashlib.py
+++ b/sys/lib/python/hashlib.py
@@ -51,14 +51,22 @@
 
 """
 
-import _sechash
-
-md5 = _sechash.md5
-sha1 = _sechash.sha1
-sha224 = _sechash.sha224
-sha256 = _sechash.sha256
-sha384 = _sechash.sha384
-sha512 = _sechash.sha512
+try:
+	import _sechash
+	md5 = _sechash.md5
+	sha1 = _sechash.sha1
+	sha224 = _sechash.sha224
+	sha256 = _sechash.sha256
+	sha384 = _sechash.sha384
+	sha512 = _sechash.sha512
+except ImportError:
+	import _hashlib
+	md5 = _hashlib.openssl_md5
+	sha1 = _hashlib.openssl_sha1
+	sha224 = _hashlib.openssl_sha224
+	sha256 = _hashlib.openssl_sha256
+	sha384 = _hashlib.openssl_sha384
+	sha512 = _hashlib.openssl_sha512
 
 algs = dict()
 for a in [md5, sha1, sha224, sha256, sha384, sha512]:
--