From: Jon Parise Date: Thu, 8 Oct 2009 06:03:10 +0000 (+0800) Subject: The md5 module is deprecated in favor of the hashlib module in newer Python X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=d3c13ab4b5c40a83881fc5813c33bb0d16cad9fe;p=oss%2Fljdump.git The md5 module is deprecated in favor of the hashlib module in newer Python versions. --- diff --git a/ljdump.py b/ljdump.py index 7ec77f2..d7930f0 100755 --- a/ljdump.py +++ b/ljdump.py @@ -24,7 +24,7 @@ # # Copyright (c) 2005-2009 Greg Hewgill -import codecs, md5, os, pickle, pprint, re, shutil, sys, urllib2, xml.dom.minidom, xmlrpclib +import codecs, os, pickle, pprint, re, shutil, sys, urllib2, xml.dom.minidom, xmlrpclib from xml.sax import saxutils MimeExtensions = { @@ -33,8 +33,14 @@ MimeExtensions = { "image/png": ".png", } +try: + from hashlib import md5 +except ImportError: + import md5 as _md5 + md5 = _md5.new + def calcchallenge(challenge, password): - return md5.new(challenge+md5.new(password).hexdigest()).hexdigest() + return md5(challenge+md5(password).hexdigest()).hexdigest() def flatresponse(response): r = {}