Skip to content

Instantly share code, notes, and snippets.

@hozumi
Forked from prasincs/sha1-hash.clj
Created December 13, 2011 16:46
Show Gist options
  • Save hozumi/1472865 to your computer and use it in GitHub Desktop.
Save hozumi/1472865 to your computer and use it in GitHub Desktop.
clojure sha1 hash
(defn sha1-str [s]
(->> (-> "sha1"
java.security.MessageDigest/getInstance
(.digest (.getBytes s)))
(map #(.substring
(Integer/toString
(+ (bit-and % 0xff) 0x100) 16) 1))
(apply str)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment