diff -uNr pycrypto-2.0.old/Hash/MD5.py pycrypto-2.0/Hash/MD5.py --- pycrypto-2.0.old/Hash/MD5.py 2010-06-01 11:19:59.000000000 +0300 +++ pycrypto-2.0/Hash/MD5.py 2010-06-01 11:35:45.000000000 +0300 @@ -1,13 +1,21 @@ # Just use the MD5 module from the Python standard library +# http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d2311689910240e425741a546576129f4c9735e2 +__revision__ = "$Id" -__revision__ = "$Id: MD5.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $" +__all__ = ['new', 'digest_size'] -from md5 import * - -import md5 -if hasattr(md5, 'digestsize'): - digest_size = digestsize - del digestsize -del md5 +try: + # The md5 module is deprecated in Python 2.6, so use hashlib when possible. + import hashlib + def new(data=""): + return hashlib.md5(data) + digest_size = new().digest_size +except ImportError: + from md5 import * + import md5 + if hasattr(md5, 'digestsize'): + digest_size = digestsize + del digestsize + del md5 diff -uNr pycrypto-2.0.old/Hash/SHA.py pycrypto-2.0/Hash/SHA.py --- pycrypto-2.0.old/Hash/SHA.py 2010-06-01 11:19:59.000000000 +0300 +++ pycrypto-2.0/Hash/SHA.py 2010-06-01 11:35:37.000000000 +0300 @@ -1,11 +1,21 @@ # Just use the SHA module from the Python standard library +# http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d2311689910240e425741a546576129f4c9735e2 +__revision__ = "$Id$" -__revision__ = "$Id: SHA.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $" +__all__ = ['new', 'digest_size'] -from sha import * -import sha -if hasattr(sha, 'digestsize'): - digest_size = digestsize - del digestsize -del sha +try: + # The md5 module is deprecated in Python 2.6, so use hashlib when possible. + import hashlib + def new(data=""): + return hashlib.sha1(data) + digest_size = new().digest_size + +except ImportError: + from sha import * + import sha + if hasattr(sha, 'digestsize'): + digest_size = digestsize + del digestsize + del sha