Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/MD5/Common-Lisp/md5-1.lisp
Normal file
14
Task/MD5/Common-Lisp/md5-1.lisp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(ql:quickload 'ironclad)
|
||||
(defun md5 (str)
|
||||
(ironclad:byte-array-to-hex-string
|
||||
(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)))
|
||||
10
Task/MD5/Common-Lisp/md5-2.lisp
Normal file
10
Task/MD5/Common-Lisp/md5-2.lisp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
(cffi:load-foreign-library "libcrypto.so")
|
||||
|
||||
(cffi:defcfun ("MD5" MD5) :void (string :string) (len :int) (ptr :pointer))
|
||||
|
||||
(let ((string-to-convert "The quick brown fox jumped over the lazy dog's back")
|
||||
(ptr (cffi:foreign-alloc :unsigned-char :count 16)))
|
||||
(md5 string-to-convert (length string-to-convert) ptr)
|
||||
(loop for i from 0 below 16 do
|
||||
(format t "~a" (write-to-string (cffi:mem-ref ptr :unsigned-char i) :base 16)))
|
||||
(cffi:foreign-free ptr))
|
||||
Loading…
Add table
Add a link
Reference in a new issue