from pycrypto triggers warnings since those modules are implemented using
the deprecated md5 and sha modules from python's stdlib. So, in order to
avoid the warning and the inferior hash implementations that come with them,
never use these particular modules from pycrypto. Instead, use hashlib or
directly use stdlib's md5 and sha modules if necessary. Thanks to Markus
Peloquin for reporting.
svn path=/main/trunk/; revision=11828
# Use pycrypto when available, prefer it over the internal fallbacks
try:
- from Crypto.Hash import MD5, SHA, SHA256, RIPEMD
-
- md5hash = _generate_hash_function("MD5", MD5.new, origin="pycrypto")
- sha1hash = _generate_hash_function("SHA1", SHA.new, origin="pycrypto")
+ from Crypto.Hash import SHA256, RIPEMD
sha256hash = _generate_hash_function("SHA256", SHA256.new, origin="pycrypto")
rmd160hash = _generate_hash_function("RMD160", RIPEMD.new, origin="pycrypto")
except ImportError, e: