From d3c13ab4b5c40a83881fc5813c33bb0d16cad9fe Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Thu, 8 Oct 2009 14:03:10 +0800 Subject: [PATCH] The md5 module is deprecated in favor of the hashlib module in newer Python versions. --- ljdump.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 = {} -- 2.39.5