diff mercurial/revlogutils/sidedata.py @ 44060:a61287a95dc3

core: migrate uses of hashlib.sha1 to hashutil.sha1 Differential Revision: https://phab.mercurial-scm.org/D7849
author Augie Fackler <augie@google.com>
date Mon, 13 Jan 2020 17:15:14 -0500
parents 9f70512ae2cf
children 9a6b409b8ebc
line wrap: on
line diff
--- a/mercurial/revlogutils/sidedata.py	Mon Jan 13 17:14:19 2020 -0500
+++ b/mercurial/revlogutils/sidedata.py	Mon Jan 13 17:15:14 2020 -0500
@@ -33,10 +33,10 @@
 
 from __future__ import absolute_import
 
-import hashlib
 import struct
 
 from .. import error
+from ..utils import hashutil
 
 ## sidedata type constant
 # reserve a block for testing purposes.
@@ -64,7 +64,7 @@
     sidedata.sort()
     rawtext = [SIDEDATA_HEADER.pack(len(sidedata))]
     for key, value in sidedata:
-        digest = hashlib.sha1(value).digest()
+        digest = hashutil.sha1(value).digest()
         rawtext.append(SIDEDATA_ENTRY.pack(key, len(value), digest))
     for key, value in sidedata:
         rawtext.append(value)
@@ -85,7 +85,7 @@
         # read the data associated with that entry
         nextdataoffset = dataoffset + size
         entrytext = text[dataoffset:nextdataoffset]
-        readdigest = hashlib.sha1(entrytext).digest()
+        readdigest = hashutil.sha1(entrytext).digest()
         if storeddigest != readdigest:
             raise error.SidedataHashError(key, storeddigest, readdigest)
         sidedata[key] = entrytext