diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2003-04-24 17:26:56 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2003-04-24 17:26:56 (GMT) |
commit | f64509e348f6928810c565c133b4176fe3c23b81 (patch) | |
tree | 689218d64e4dc3dfd6232dc1d9bf5d0bd07eb32f /Demo/md5test | |
parent | 30dd9bc0bfe545f6a4f92762941de594a14fbf2d (diff) | |
download | cpython-f64509e348f6928810c565c133b4176fe3c23b81.zip cpython-f64509e348f6928810c565c133b4176fe3c23b81.tar.gz cpython-f64509e348f6928810c565c133b4176fe3c23b81.tar.bz2 |
Move all the imports to the top; use md5.new()
Diffstat (limited to 'Demo/md5test')
-rwxr-xr-x | Demo/md5test/md5driver.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Demo/md5test/md5driver.py b/Demo/md5test/md5driver.py index 1b753cf..61aea61 100755 --- a/Demo/md5test/md5driver.py +++ b/Demo/md5test/md5driver.py @@ -1,4 +1,6 @@ import string +import md5 +from sys import argv def MDPrint(str): outstr = '' @@ -20,8 +22,6 @@ def makestr(start, end): return result -from md5 import md5 - def MDTimeTrial(): TEST_BLOCK_SIZE = 1000 TEST_BLOCKS = 10000 @@ -42,7 +42,7 @@ def MDTimeTrial(): print 'MD5 time trial. Processing', TEST_BYTES, 'characters...' t1 = time() - mdContext = md5() + mdContext = md5.new() for i in range(TEST_BLOCKS): mdContext.update(data) @@ -57,13 +57,13 @@ def MDTimeTrial(): def MDString(str): - MDPrint(md5(str).digest()) + MDPrint(md5.new(str).digest()) print '"' + str + '"' def MDFile(filename): f = open(filename, 'rb'); - mdContext = md5() + mdContext = md5.new() while 1: data = f.read(1024) @@ -78,7 +78,7 @@ def MDFile(filename): import sys def MDFilter(): - mdContext = md5() + mdContext = md5.new() while 1: data = sys.stdin.read(16) @@ -106,8 +106,6 @@ def MDTestSuite(): MDFile('foo') -from sys import argv - # I don't wanna use getopt(), since I want to use the same i/f... def main(): if len(argv) == 1: |