password encryption

This commit is contained in:
michaelr 2016-03-18 15:07:20 +02:00
parent 1155575f11
commit ee20d8a13b
1 changed files with 12 additions and 0 deletions

View File

@ -18,6 +18,15 @@
(defn decrypt [private-key content]
(.decrypt js/ecc private-key content))
(defn password-encrypt [password content]
(-> (.-sjcl js/ecc)
(.encrypt password content)))
(defn password-decrypt [password content]
(-> (.-sjcl js/ecc)
(.decrypt password content)))
(comment
(init)
@ -25,4 +34,7 @@
(def encd (encrypt (:public keypair) "Hello world"))
(decrypt (:private keypair) encd)
(->> (password-encrypt "password" "text")
(password-decrypt "password"))
)