RosettaCodeData/Task/MD5/Ol/md5-2.ol

19 lines
613 B
Plaintext

(define (test str)
(define md5 "----------------")
(MD5 str (string-length str) md5)
(for-each display (list "\"" str "\": "))
(for-each (lambda (c)
(define hex "0123456789abcdef")
(display (string (ref hex (>> c 4))))
(display (string (ref hex (band c #x0F)))))
(string->list md5))
(print))
(test "")
(test "a")
(test "abc")
(test "message digest")
(test "abcdefghijklmnopqrstuvwxyz")
(test "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
(test "12345678901234567890123456789012345678901234567890123456789012345678901234567890")