Using hashlib instead of deprecated md5

This commit is contained in:
Stefan Ritter 2010-12-14 09:55:09 +01:00
parent 51c4cfc7f2
commit b48033faca

View File

@ -21,7 +21,7 @@ import re
from ConfigParser import ConfigParser from ConfigParser import ConfigParser
from cgi import FieldStorage from cgi import FieldStorage
from smtplib import SMTP from smtplib import SMTP
from md5 import new as newmd5 from hashlib import md5
from glob import glob from glob import glob
from random import randint from random import randint
@ -33,7 +33,7 @@ line_start_plus = re.compile("^\+.*$")
tab = "\t" tab = "\t"
def generate_uuid(string): def generate_uuid(string):
string_md5sum = newmd5(string).hexdigest() string_md5sum = md5(string).hexdigest()
string = str.join("-", (string_md5sum[0:8], string_md5sum[8:12], string_md5sum[12:16], string_md5sum[16:20], string_md5sum[20:32])) string = str.join("-", (string_md5sum[0:8], string_md5sum[8:12], string_md5sum[12:16], string_md5sum[16:20], string_md5sum[20:32]))
return string return string