From ff5f51d45ec24976f6dc8d9b52da505cdd32063a Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 19 Oct 2010 03:32:45 -0400 Subject: [PATCH] Forward-port to new md5 interface. --- hashgen.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hashgen.py b/hashgen.py index efad28f..5c31f19 100755 --- a/hashgen.py +++ b/hashgen.py @@ -1,9 +1,9 @@ #!/bin/env python -# Generate hash function mapping text bytes to an unsigned integral type, using -# MD5 to generate the magic values. Based on an algorithm suggested by -# Ron Rivest. +# Generate hash function mapping text bytes to an unsigned integral +# type, using MD5 to generate the magic values. Based on an algorithm +# suggested by Ron Rivest. -import sys, md5 +import sys, hashlib def tablegen(maxlen, width): print "static hashval_t magicbits[256][%d] = " % maxlen @@ -13,7 +13,7 @@ def tablegen(maxlen, width): for j in range(maxlen): if j % 3 == 0: sys.stdout.write('\n\t') - m = md5.new() + m = hashlib.md5() m.update(`i` + `j`) sys.stdout.write('0x' + m.hexdigest()[-(width*2):] + "ULL,") print "}, /* end char %02x */" % i -- 2.43.0