Skip to content

Instantly share code, notes, and snippets.

@iantruslove
Created March 21, 2014 14:56
Show Gist options
  • Save iantruslove/9688036 to your computer and use it in GitHub Desktop.
Save iantruslove/9688036 to your computer and use it in GitHub Desktop.
scrypt password hashing
(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