diff options
Diffstat (limited to 'Lib/test/test_md5.py')
-rw-r--r-- | Lib/test/test_md5.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_md5.py b/Lib/test/test_md5.py new file mode 100644 index 0000000..43f12ca --- /dev/null +++ b/Lib/test/test_md5.py @@ -0,0 +1,24 @@ +# Testing md5 module + +import string +from md5 import md5 + +def hexstr(s): + h = string.hexdigits + r = '' + for c in s: + i = ord(c) + r = r + h[(i >> 4) & 0xF] + h[i & 0xF] + return r + +def md5test(s): + return 'MD5 ("' + s + '") = ' + hexstr(md5(s).digest()) + +print 'MD5 test suite:' +print md5test('') +print md5test('a') +print md5test('abc') +print md5test('message digest') +print md5test('abcdefghijklmnopqrstuvwxyz') +print md5test('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') +print md5test('12345678901234567890123456789012345678901234567890123456789012345678901234567890') |