Mercurial > hg
diff hgext/infinitepush/store.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 | 70d42e2ad9b4 |
children | a52bf967e90a |
line wrap: on
line diff
--- a/hgext/infinitepush/store.py Mon Jan 13 17:16:54 2020 -0500 +++ b/hgext/infinitepush/store.py Mon Jan 13 14:12:31 2020 -0500 @@ -6,7 +6,6 @@ from __future__ import absolute_import import abc -import hashlib import os import subprocess import tempfile @@ -16,7 +15,10 @@ node, pycompat, ) -from mercurial.utils import procutil +from mercurial.utils import ( + hashutil, + procutil, +) NamedTemporaryFile = tempfile.NamedTemporaryFile @@ -87,7 +89,7 @@ return os.path.join(self._dirpath(filename), filename) def write(self, data): - filename = node.hex(hashlib.sha1(data).digest()) + filename = node.hex(hashutil.sha1(data).digest()) dirpath = self._dirpath(filename) if not os.path.exists(dirpath):