comparison mercurial/sslutil.py @ 29341:0d83ad967bf8

cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1 All versions of Python we support or hope to support make the hash functions available in the same way under the same name, so we may as well drop the util forwards.
author Augie Fackler <raf@durin42.com>
date Fri, 10 Jun 2016 00:12:33 -0400
parents ecc9b788fd69
children 98e8313dcd9e
comparison
equal deleted inserted replaced
29340:ae92c3eee88e 29341:0d83ad967bf8
7 # This software may be used and distributed according to the terms of the 7 # This software may be used and distributed according to the terms of the
8 # GNU General Public License version 2 or any later version. 8 # GNU General Public License version 2 or any later version.
9 9
10 from __future__ import absolute_import 10 from __future__ import absolute_import
11 11
12 import hashlib
12 import os 13 import os
13 import ssl 14 import ssl
14 import sys 15 import sys
15 16
16 from .i18n import _ 17 from .i18n import _
386 return 387 return
387 388
388 # If a certificate fingerprint is pinned, use it and only it to 389 # If a certificate fingerprint is pinned, use it and only it to
389 # validate the remote cert. 390 # validate the remote cert.
390 peerfingerprints = { 391 peerfingerprints = {
391 'sha1': util.sha1(peercert).hexdigest(), 392 'sha1': hashlib.sha1(peercert).hexdigest(),
392 'sha256': util.sha256(peercert).hexdigest(), 393 'sha256': hashlib.sha256(peercert).hexdigest(),
393 'sha512': util.sha512(peercert).hexdigest(), 394 'sha512': hashlib.sha512(peercert).hexdigest(),
394 } 395 }
395 396
396 def fmtfingerprint(s): 397 def fmtfingerprint(s):
397 return ':'.join([s[x:x + 2] for x in range(0, len(s), 2)]) 398 return ':'.join([s[x:x + 2] for x in range(0, len(s), 2)])
398 399