> (str binary-array) returns the toString of the array, which is something
> like "[B@5d5d0293". That has nothing to do with the contents of the array.
> I think you want the base64 encoded string here.

Hmm, interesting. I had assumed that I wanted a string run through
SHA1, so I created the string, then called getBytes on it to feed it
to SHA1:

 digest-as-string (apply str nonce created secret)
 digest (.digest (java.security.MessageDigest/getInstance "sha1")
(.getBytes digest-as-string))

But this is not working.





On Mar 4, 12:49 pm, Aaron Cohen <aa...@assonance.org> wrote:
> On Mon, Mar 4, 2013 at 11:12 AM, larry google groups <
>
> lawrencecloj...@gmail.com> wrote:
> > > expects its argument to be a byte array:
> >http://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest....
>
> > > which can be obtained from a string using String#getBytes.
>
> > I appreciate your suggestion. For most of the attempts that I have
> > made, I have used this code:
>
> >  nonce (DigestUtils/md5Hex (random-string 32))
> >  nonce-encoded-base64 (Base64/encodeBase64 (.getBytes nonce))
>
> Is this used somewhere?
>
> >  date-formatter (new SimpleDateFormat "yyyy-MM-dd'T'HH:mm:ss'Z'")
> >  created (.format date-formatter (new Date))
> >  digest-as-string (apply str nonce created secret)
>
> (str binary-array) returns the toString of the array, which is something
> like "[B@5d5d0293". That has nothing to do with the contents of the array.
> I think you want the base64 encoded string here.
>
> --Aaron

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