Re: I want to get sha1 of a string

2014-06-29 Thread Daniel
+1 for Pandect. It's an excellent library which leverages bouncy castle and has had tons of top notch work put into it. Fast, well documented, and super easy to use. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: I want to get sha1 of a string

2014-06-29 Thread xavi
I found that the hexadecimal returned by Zach's solution sometimes has a "-" prefix (for example, for the "hello" string). I guess because BigInteger(byte[]) (http://docs.oracle.com/javase/8/docs/api/java/math/BigInteger.html#BigInteger-byte:A-) interprets the byte array as a two's-complement

Re: I want to get sha1 of a string

2014-03-02 Thread action
ok,think you! 在 2014年3月2日星期日UTC+8上午12时28分25秒,JPH写道: > > I've had good experiences with https://github.com/xsc/pandect. > > You can also use Java interop like this: > https://gist.github.com/prasincs/827272 > > JPH > > > On 03/02/2014 12:26 AM, action wrote: > > do like this: > > (ns clojurew

Re: I want to get sha1 of a string

2014-03-02 Thread Ben Smith-Mannschott
(-> "Hello, World!" .getBytes create-hash ...) Will get you the hash of the string encoded to bytes using *some random encoding*. (Whatever the platform you're currently running on defaults to.) You should explicitly choose an encoding and stick to it. I'd suggest UTF-8 since that can encode all

Re: I want to get sha1 of a string

2014-03-01 Thread Zach Oakes
You can use java.security.MessageDigest. For example: (defn create-hash [data-barray] (.digest (java.security.MessageDigest/getInstance "SHA1") data-barray)) It takes and returns a byte array, but converting from/to a string is fairly straight-forward: (->> "Hello, World!" .getBytes

Re: I want to get sha1 of a string

2014-03-01 Thread JPH
I've had good experiences with https://github.com/xsc/pandect. You can also use Java interop like this: https://gist.github.com/prasincs/827272 JPH On 03/02/2014 12:26 AM, action wrote: > do like this: > (ns clojurewerkz.support.hashing > (:require [clojurewerkz.support.internal :as i]) > (

I want to get sha1 of a string

2014-03-01 Thread action
do like this: (ns clojurewerkz.support.hashing (:require [clojurewerkz.support.internal :as i]) (:import [com.google.common.hash Hashing HashFunction HashCode])) but: FileNotFoundException Could not locate clojurewerkz/support__init.class or cloju rewerkz/support.clj on classpath: clojure.la