Created
August 28, 2013 12:07
-
-
Save ngsw-taro/6365287 to your computer and use it in GitHub Desktop.
ClojureでSlideshareのAPIを叩く。まずはSHA-1求める関数を作る
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import 'java.security.MessageDigest) | |
(defn sha1 [s] | |
(let [md (MessageDigest/getInstance "SHA-1")] | |
(do | |
(. md update (. s getBytes)) | |
(apply str (map #(format "%02x" %) (. md digest)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment