crypto.derive()
Derives a key using PBKDF2-HMAC-SHA-256.
Signature
crypto.derive(password, salt[, iterations[, length]])
Parameters
Password and salt as text/packed, with at least 16 salt bytes. Iterations defaults to 600000, range 1000 through C INT_MAX. Length defaults to 32, range 14 through C INT_MAX.
Returns
Packed key.
Behavior
Blocking computation, with cost depending on iterations and length.
Errors
Bad bounds, oversized password/salt, short salt or backend failure.
Example
use crypto
salt = crypto.random(16)
assert(count(crypto.derive('sample password', salt)) == 32)