Created
March 21, 2014 14:56
-
-
Save iantruslove/9688036 to your computer and use it in GitHub Desktop.
scrypt password hashing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo.user | |
(:require [clojurewerkz.scrypt.core :as sc])) | |
(defn calculate-hash [password salt] | |
(sc/encrypt (str password salt) 16384 8 1)) | |
(defn verify-hash [hash password salt] | |
(sc/verify (str password salt) hash)) | |
(defn verify-user-password [user password] | |
(verify-hash (:hashed-password user) password (:salt user))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment