File size: 866 Bytes
43203b4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | (in-package :clache)
(use-syntax :annot)
(defun symbol-fqn (symbol)
"Return a fully qualified name of SYMBOL in string. For
example, (symbol-fqn 'if) will return \"COMMON-LISP:IF\"."
(declare (symbol symbol))
(format nil "~A:~A"
(package-name (symbol-package symbol))
(symbol-name symbol)))
(defun object-to-string (object)
"Convert OBJECT into string by using PRINC-TO-STRING if OBJECT is
not a symbol, or by using SYMBOL-FQN if OBJECT is a symbol."
(if (symbolp object)
(symbol-fqn object)
(princ-to-string object)))
(defun md5-hex-string (string)
"Return a MD5 digest of STRING in hex string."
(let* ((octets (babel:string-to-octets string))
(digest (ironclad:digest-sequence 'ironclad:md5 octets))
(hex-string (format nil "~{~2,'0X~}" (coerce digest 'list))))
(string-downcase hex-string)))
|