Hi David,

David Soria Parra <d...@php.net> writes:
> any feeback on this so far?

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

"digest-to-str" is a bit misleading as hexadecimal digits are not the
only way you can represent a digest as a string: base 64 and base 32 are
also quite common.

Additionally, named arguments are typically useful when the arguments
are optional or there's a lot of them.  I'd probably just drop the
:algorithm keyword, since you're always going to need to specify it.

Something important that you don't seem to be covering is incremental
digests (using the .update method).  I'm not sure what the best way to
expose this is (push or pull: update-digest vs passing in a lazy seq),
but most non-trivial uses of digests are going to want to be able to do
things incrementally.  In my experience it's very bad to encourage
people to load full datasets into memory where it's unnecessary (even
just the simple cases of sha1summing a file) -- that road leads to
brittle applications and OutOfMemoryErrors.

One might argue that this is just a convenience for trivial string and
byte array usage and that anybody doing it incrementally should use the
raw MessageDigest API, but at the end of the day, if somebody provides
some sort of Clojure API many people are going to try and shoehorn all
their uses into it.

Alex

-- 
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