Hi,

I want to propose a wrapper around MessageDigest to provide a simple way
to generate digests.

The following proposal includes a multimethods digest, which operates either
on strings or on arrays of bytes.

I think digests are usuall used with strings. To expose the byte array api
from java's message digest class I used multimethods. Other multimethods
do not exists, as I think it doesn't make much sense to define digest
on something like integers or sequences.

The function digest-to-str returns a typical string representation.

The available algorithms correspond to the algorithms that are available
using MessageDigest.

The code can be found here:
http://github.com/dsp/clojure-contrib/commit/77c9f7dbe071d90bf6cb385db4859e76d5e8ff19
    

A typical example would be:
(digest-to-str (digest "hello world" :algorithm "SHA-1"))

I'm open for suggestions, as I'm new to clojure and the API might not
be perfectly suited for clojure.

- David



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to