Provides different hashing/verification functions.
Provides different hashing/verification functions.
(bcrypt-hash password & {:keys [log-rounds]})
Hashes a given plaintext password using bcrypt and an optional :log-rounds (log2 of the number of rounds of hashing to apply, defaults to 10 as of this writing).
Hashes a given plaintext password using bcrypt and an optional :log-rounds (log2 of the number of rounds of hashing to apply, defaults to 10 as of this writing).
(bcrypt-verify password hash)
Returns true if the plaintext [password] corresponds to [hash], the result of previously hashing that password.
Returns true if the plaintext [password] corresponds to [hash], the result of previously hashing that password.
(create-credentials-fn identity-fn
&
{:keys [password-key hash-verify-fn]
:or {password-key :password
hash-verify-fn bcrypt-verify}})
Creates a credentials function. Accepts:
[identity-fn] - a function of one argument, that returns the user's identity corresponding to the given argument value.
:password-key - a key to be used to resolve the hash of user's password from the identity map returned by identity-fn. Defaults to :password.
:hash-verify-fn - a hash verification function. Defaults to bcrypt-verify
.
Creates a credentials function. Accepts: [identity-fn] - a function of one argument, that returns the user's identity corresponding to the given argument value. :password-key - a key to be used to resolve the hash of user's password from the identity map returned by identity-fn. Defaults to :password. :hash-verify-fn - a hash verification function. Defaults to `bcrypt-verify`.
(gen-salt)
(gen-salt size)
Generates a random salt array.
Generates a random salt array.
(pbkdf2-hash password & {:keys [iterations salt] :or {iterations 10000}})
Hashes a given plaintext password using PBKDF2, an optional :iterations count (defaults to 10000) and an optional salt (a byte array, defaults to a random array of size 8).
Hashes a given plaintext password using PBKDF2, an optional :iterations count (defaults to 10000) and an optional salt (a byte array, defaults to a random array of size 8).
(pbkdf2-verify password hash)
Returns true if the plaintext [password] corresponds to [hash], the result of previously hashing that password.
Returns true if the plaintext [password] corresponds to [hash], the result of previously hashing that password.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close