diff hgext/largefiles/lfcommands.py @ 44062:2d49482d0dd4

hgext: replace references to hashlib.sha1 with hashutil.sha1 When in a non-pure build of Mercurial, this will provide protections against SHA1 collision attacks. Differential Revision: https://phab.mercurial-scm.org/D7851
author Augie Fackler <augie@google.com>
date Mon, 13 Jan 2020 14:12:31 -0500
parents 9f70512ae2cf
children a03c177a4679
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Mon Jan 13 17:16:54 2020 -0500
+++ b/hgext/largefiles/lfcommands.py	Mon Jan 13 14:12:31 2020 -0500
@@ -10,7 +10,6 @@
 from __future__ import absolute_import
 
 import errno
-import hashlib
 import os
 import shutil
 
@@ -29,6 +28,7 @@
     scmutil,
     util,
 )
+from mercurial.utils import hashutil
 
 from ..convert import (
     convcmd,
@@ -273,7 +273,7 @@
                         )
 
                 # largefile was modified, update standins
-                m = hashlib.sha1(b'')
+                m = hashutil.sha1(b'')
                 m.update(ctx[f].data())
                 hash = node.hex(m.digest())
                 if f not in lfiletohash or lfiletohash[f] != hash: