Skip to content

Instantly share code, notes, and snippets.

@defclass
Forked from hozumi/sha1-hash.clj
Created November 19, 2018 07:59
Show Gist options
  • Save defclass/f6aed905fe823f8ee167c7e628ec87ca to your computer and use it in GitHub Desktop.
Save defclass/f6aed905fe823f8ee167c7e628ec87ca 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