RosettaCodeData/Task/MD5/Common-Lisp/md5-1.lisp

15 lines
585 B
Common Lisp
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
(ql:quickload 'ironclad)
2015-11-18 06:14:39 +00:00
(defun md5 (str)
2013-04-10 21:29:02 -07:00
(ironclad:byte-array-to-hex-string
2015-11-18 06:14:39 +00:00
(ironclad:digest-sequence :md5
(ironclad:ascii-string-to-byte-array str))))
(defvar *tests* '(""
"a"
"abc"
"message digest"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"))
(dolist (msg *tests*)
(format T "~s: ~a~%" msg (md5 msg)))