[hunchentoot-devel] only simple-string's are allowed for md5:md5sum-sequence

Anton Vodonosov avodonosov at yandex.ru
Tue Dec 9 03:22:11 UTC 2008


Hello.

Huncentoot used md5 library to generate session strings.
The function MD5:MD5SUM-SEQUENCE allows only SIMPLE-STRINGs
as arguments. Hunchentoot passes result of FORMAT, which
is not necessary returns SIMPLE-STRING (although in many
implementations it does).

In particular just encountered this error when testing Hunchentoot
on ECL (with the patch sent by Marko Kocic here:
http://common-lisp.net/pipermail/tbnl-devel/2008-November/004474.html)

The fix will be as follows:

 (defun md5-hex (string)
   "Calculates the md5 sum of the string STRING and returns it as a hex string."
   (with-output-to-string (s)
-    (loop for code across (md5:md5sum-sequence string)
+    (loop for code across (md5:md5sum-sequence (coerce string 'simple-string))
           do (format s "~2,'0x" code))))


Best regards,
- Anton





More information about the Tbnl-devel mailing list