[plt-scheme] Message digests: md5, sha1, etc.
Hi all,
Fresh of the press is set of bindings for the message digest
algorithms of libcrypto:
<http://planet.plt-scheme.org/300/docs/soegaard/digest.plt/1/0/doc.txt>
I have tested it on Windows, so I'd appreciate if a kind soul can
tell me, whether it works on OS X or Linux too. It ought to, but ...
Example:
> (require (planet "digest.ss" ("soegaard" "digest.plt" 1 0)))
> (digest #"abc" 'md5)
"900150983cd24fb0d6963f7d28e17f72"
> (digest #"abc" 'sha1)
"a9993e364706816aba3e25717850c26c9cd0d89d"
Note that the libcrypto md5 is somewhat faster than (lib "md5.ss"):
> (define b (make-bytes 10000000))
> (md5 b)
"311175294563b07db7ea80dee2e5b3c6"
> (require (prefix mz: (lib "md5.ss")))
> (mz:md5 b)
#"311175294563b07db7ea80dee2e5b3c6"
> (time (md5 b))
cpu time: 16 real time: 15 gc time: 0
"311175294563b07db7ea80dee2e5b3c6"
> (time (mz:md5 b))
cpu time: 14734 real time: 15079 gc time: 0
#"311175294563b07db7ea80dee2e5b3c6"
--
Jens Axel Søgaard