password encryption
This commit is contained in:
parent
1155575f11
commit
ee20d8a13b
|
@ -18,6 +18,15 @@
|
||||||
(defn decrypt [private-key content]
|
(defn decrypt [private-key content]
|
||||||
(.decrypt js/ecc 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
|
(comment
|
||||||
(init)
|
(init)
|
||||||
|
|
||||||
|
@ -25,4 +34,7 @@
|
||||||
(def encd (encrypt (:public keypair) "Hello world"))
|
(def encd (encrypt (:public keypair) "Hello world"))
|
||||||
(decrypt (:private keypair) encd)
|
(decrypt (:private keypair) encd)
|
||||||
|
|
||||||
|
(->> (password-encrypt "password" "text")
|
||||||
|
(password-decrypt "password"))
|
||||||
|
|
||||||
)
|
)
|
Loading…
Reference in New Issue