create-random-string revisited

Sabra Crolleton sabra.crolleton at gmail.com
Sat Oct 26 16:31:06 UTC 2013


Quite awhile ago I proposed strengthening create-random-string with
something that required cl-ssl as a dependency and it was correctly pointed
out that some implementations do not play well with cl-ssl. Would using the
strong-random function from ironclad be acceptable? E.g.

(defun create-random-string (&optional (n 10) (base 16))
  "Creates a random string using ironclad's strong-random function
with base BASE and N digits"
    (setf crypto:*prng* (crypto:make-prng :fortuna))
    (subseq (with-output-to-string (s)
       (loop for i to n do
            (format s "~VR" base
                    (ironclad:strong-random 100000000000))))
            0 n))

Sabra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20131026/654ecdc2/attachment.html>


More information about the Tbnl-devel mailing list