Back

encrypt (clj)

(source)

function

(encrypt raw) (encrypt raw iterations) (encrypt raw iterations algorithm) (encrypt raw iterations algorithm salt)
Encrypt a password string using the PBKDF2 algorithm. The default number of iterations is 100,000. If a salt is not specified, 8 random bytes are generated from a cryptographically secure source. The default algorithm is "HMAC-SHA1". When running on JDK 1.8 "HMAC-SHA256" is also supported. The number of iterations and salt are encoded in the output in the following formats for HMAC-SHA1: <iterations>$<salt>$<encrypted password> And for all other algoritms: <iterations>$<algorithm>$<salt>$<encrypted password> The iterations, salt, and encrypted password are all Base64 encoded.

Examples