# HG changeset patch # User Augie Fackler # Date 2020-01-13 22:14:19 # Node ID 0803f803ba03b04f9132f6cabfa10d73c664a8eb # Parent bde1cd4c99d9bb0ead400ae333619cadcd8480ad hashutil: new package for hashing-related features Right now this just tries to use our sha1dc and if it's missing (eg a --pure build) we fall back to hashlib. I imagine in the future we'll want some other things in here for detecting what hasher is in use as we transition off sha1. Differential Revision: https://phab.mercurial-scm.org/D7848 diff --git a/mercurial/utils/hashutil.py b/mercurial/utils/hashutil.py new file mode 100644 --- /dev/null +++ b/mercurial/utils/hashutil.py @@ -0,0 +1,9 @@ +from __future__ import absolute_import + +import hashlib + +try: + from mercurial.thirdparty import sha1dc + sha1 = sha1dc.sha1 +except (ImportError, AttributeError): + sha1 = hashlib.sha1