Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 8296:908c5906091b
util: remove md5
This hash function is broken and should not be used by new code. It is
currently only used by keepalive.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Mon, 04 May 2009 21:30:39 +0200 |
parents | 1ea7e7d90007 |
children | 7f27e69dd27f |
comparison
equal
deleted
inserted
replaced
8295:1ea7e7d90007 | 8296:908c5906091b |
---|---|
17 import cStringIO, errno, re, shutil, sys, tempfile, traceback, error | 17 import cStringIO, errno, re, shutil, sys, tempfile, traceback, error |
18 import os, stat, threading, time, calendar, glob, osutil, random | 18 import os, stat, threading, time, calendar, glob, osutil, random |
19 import imp | 19 import imp |
20 | 20 |
21 # Python compatibility | 21 # Python compatibility |
22 | |
23 def md5(s): | |
24 try: | |
25 import hashlib | |
26 _md5 = hashlib.md5 | |
27 except ImportError: | |
28 from md5 import md5 as _md5 | |
29 global md5 | |
30 md5 = _md5 | |
31 return _md5(s) | |
32 | 22 |
33 def sha1(s): | 23 def sha1(s): |
34 try: | 24 try: |
35 import hashlib | 25 import hashlib |
36 _sha1 = hashlib.sha1 | 26 _sha1 = hashlib.sha1 |