hgext/largefiles/lfutil.py
changeset 44062 2d49482d0dd4
parent 43584 a02e4c12ae60
child 44379 ca82929e433d
--- a/hgext/largefiles/lfutil.py	Mon Jan 13 17:16:54 2020 -0500
+++ b/hgext/largefiles/lfutil.py	Mon Jan 13 14:12:31 2020 -0500
@@ -11,7 +11,6 @@
 
 import contextlib
 import copy
-import hashlib
 import os
 import stat
 
@@ -32,6 +31,7 @@
     util,
     vfs as vfsmod,
 )
+from mercurial.utils import hashutil
 
 shortname = b'.hglf'
 shortnameslash = shortname + b'/'
@@ -432,7 +432,7 @@
 def copyandhash(instream, outfile):
     '''Read bytes from instream (iterable) and write them to outfile,
     computing the SHA-1 hash of the data along the way. Return the hash.'''
-    hasher = hashlib.sha1(b'')
+    hasher = hashutil.sha1(b'')
     for data in instream:
         hasher.update(data)
         outfile.write(data)
@@ -472,7 +472,7 @@
 def hexsha1(fileobj):
     """hexsha1 returns the hex-encoded sha1 sum of the data in the file-like
     object data"""
-    h = hashlib.sha1()
+    h = hashutil.sha1()
     for chunk in util.filechunkiter(fileobj):
         h.update(chunk)
     return hex(h.digest())