Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.14 KB

README.md

File metadata and controls

47 lines (33 loc) · 1.14 KB

a library for securely hashing passwords

Following algorithms are supported:

CircleCI

Clojars Project

Usage

Pick an encryption algorithm, either bcrypt or scrypt:

(require '[macchiato.crypto.<algorithm> :as password])

Then use the encrypt function to apply a secure, one-way encryption algorithm to a password:

(def encrypted (password/encrypt "foobar"))

And the check function to check the encrypted password against a plaintext password:

(password/check "foobar" encrypted) ;; => true

The encrypt and check functions have async versions as well:

(password/encrypt-async
  "secret"
  (fn [err result]
    (is (scrypt/check "secret" result))))

(password/check-async
  "secret"
  (password/encrypt "secret")
  (fn [err result]
    (is result)))