Sha256: c76dfda8a02d8ec983af4ac17f0c2d8bac14fa171e4ed71119c9a98a1ac7f57c

Contents?: true

Size: 770 Bytes

Versions: 30

Compression:

Stored size: 770 Bytes

Contents

# 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')

# hexdigest is new with Python 2.0
m = md5('testing the hexdigest method')
h = m.hexdigest()
if hexstr(m.digest()) != h:
    print 'hexdigest() failed'

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rubyfox-server-2.19.2.0 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.17.3.2 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.17.3.1 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.17.3.0 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.16.3.2 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.16.3.1 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.16.0.4 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.16.0.3 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.16.0.2 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.16.0.1 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.16.0.0 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.13.7.3 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.13.6.2 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.13.6.1 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.13.5.1 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.13.4.1 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.13.3.1 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.12.5.1 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.12.5.0 lib/rubyfox/server/data/lib/Lib/test/test_md5.py
rubyfox-server-2.12.4.0 lib/rubyfox/server/data/lib/Lib/test/test_md5.py