https://github.com/macchiato-framework/macchiato-crypto
Library for securely hashing passwords
https://github.com/macchiato-framework/macchiato-crypto
Last synced: 4 months ago
JSON representation
Library for securely hashing passwords
- Host: GitHub
- URL: https://github.com/macchiato-framework/macchiato-crypto
- Owner: macchiato-framework
- License: mit
- Created: 2017-01-01T15:17:29.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-08-20T23:28:35.000Z (almost 6 years ago)
- Last Synced: 2025-10-21T23:37:20.117Z (8 months ago)
- Language: Clojure
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### a library for securely hashing passwords
Following algorithms are supported:
* [Bcrypt](http://bcrypt.sourceforge.net/)
* [scrypt](http://www.tarsnap.com/scrypt.html)
[](https://circleci.com/gh/macchiato-framework/macchiato-crypto)
[](https://clojars.org/macchiato/crypto)
## Usage
Pick an encryption algorithm, either `bcrypt` or `scrypt`:
```clojure
(require '[macchiato.crypto. :as password])
```
Then use the `encrypt` function to apply a secure, one-way encryption
algorithm to a password:
```clojure
(def encrypted (password/encrypt "foobar"))
```
And the `check` function to check the encrypted password against a
plaintext password:
```clojure
(password/check "foobar" encrypted) ;; => true
```
The `encrypt` and `check` functions have async versions as well:
```clojure
(password/encrypt-async
"secret"
(fn [err result]
(is (scrypt/check "secret" result))))
(password/check-async
"secret"
(password/encrypt "secret")
(fn [err result]
(is result)))
```