2013/3/4 larry google groups <lawrencecloj...@gmail.com>

> I appreciate your suggestion, but I feel that I need to understand why
> I failed when I used these classes:
>

(.digest (java.security.MessageDigest/getInstance "sha1")
digest-as-string)

expects its argument to be a byte array:
http://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html

which can be obtained from a string using String#getBytes.

Also, in

(apply str (.getBytes nonce) created secret)

I am not sure you get what you expect. clojure.core/str will take a string
representation of a byte array and concat it. What you probably want is
to concat all strings and then .getBytes from the result. Compare:

user=> (str (.getBytes "aa") "bb" "cc")
"[B@5d5d0293bbcc"
user=> (str "aa" "bb" "cc")
"aabbcc"
user=> (.getBytes (str "aa" "bb" "cc"))
#<byte[] [B@d9f8120>
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to