Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
1 merge request!13Merge docker-related changes
Pipeline #
......@@ -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', '')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment