ryoakg
2/9/2016 - 5:58 AM

base64.clj

(defn ^String base64-encode [^String s]
  (.encodeToString (java.util.Base64/getEncoder) (.getBytes s)))

(defn ^String base64-decode [^String s]
  (->> s
       (.decode (java.util.Base64/getDecoder))
       String.))


;;; Usage
(-> "aa" base64-encode)
;; => "YWE="
(-> "aa" base64-encode base64-decode)
;; => "aa"