Commit c695fc93 authored by Philip ABBET's avatar Philip ABBET
Browse files

Fix the hash computation for binary algorithms, while retaining the original way for most cases

parent 271b038f
Pipeline #5355 failed with stage
in 60 minutes and 37 seconds
......@@ -41,8 +41,12 @@ import simplejson
def _sha256(s):
"""A python2/3 replacement for :py:func:`haslib.sha256`"""
if isinstance(s, str): s = six.u(s)
return hashlib.sha256(s.encode('utf8')).hexdigest()
try:
if isinstance(s, str): s = six.u(s)
return hashlib.sha256(s.encode('utf8')).hexdigest()
except:
return hashlib.sha256(s).hexdigest()
def _compact(text):
return text.replace(' ', '').replace('\n', '')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment