Skip to content

Commit

Permalink
Use unicode for hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
svillar committed Mar 12, 2020
1 parent 3517bbb commit c41dd73
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/manifest/sourcefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import re
import os
from collections import deque
from six import binary_type, iteritems
from six import binary_type, iteritems, PY3
from six.moves.urllib.parse import urljoin
from fnmatch import fnmatch

Expand Down Expand Up @@ -308,7 +308,8 @@ def hash(self):
content = f.read()

data = b"".join((b"blob ", b"%d" % len(content), b"\0", content))
self._hash = hashlib.sha1(data).hexdigest()
hash_str = hashlib.sha1(data).hexdigest()
self._hash = hash_str if PY3 else unicode(hash_str, encoding='ascii')

return self._hash

Expand Down

0 comments on commit c41dd73

Please sign in to comment.