Mercurial > public > mercurial-scm > hg-stable
diff mercurial/sslutil.py @ 35582:72b91f905065
py3: use node.hex(h.digest()) instead of h.hexdigest()
hashlib.sha1.hexdigest() returns str on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D1792
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 29 Dec 2017 05:25:27 +0530 |
parents | c8ecd96cc357 |
children | 424994a0adfd |
line wrap: on
line diff
--- a/mercurial/sslutil.py Fri Dec 29 05:22:06 2017 +0530 +++ b/mercurial/sslutil.py Fri Dec 29 05:25:27 2017 +0530 @@ -17,6 +17,7 @@ from .i18n import _ from . import ( error, + node, pycompat, util, ) @@ -808,9 +809,9 @@ # If a certificate fingerprint is pinned, use it and only it to # validate the remote cert. peerfingerprints = { - 'sha1': hashlib.sha1(peercert).hexdigest(), - 'sha256': hashlib.sha256(peercert).hexdigest(), - 'sha512': hashlib.sha512(peercert).hexdigest(), + 'sha1': node.hex(hashlib.sha1(peercert).digest()), + 'sha256': node.hex(hashlib.sha256(peercert).digest()), + 'sha512': node.hex(hashlib.sha512(peercert).digest()), } def fmtfingerprint(s):