Function orion::default::pbkdf2 [−][src]
pub fn pbkdf2(
password: &[u8],
salt: &[u8],
len: usize
) -> Result<Vec<u8>, UnknownCryptoError>
PBKDF2-HMAC-SHA512 derived key, using 512.000 as iteration count.
Exceptions:
An exception will be thrown if:
- The length of the salt is less than 16 bytes
- The specified length for the derived key is less than 14 bytes
Note:
Salts should always be generated using a CSPRNG. The gen_rand_key
function
in util
can be used for this.
Usage example:
use orion::default; use orion::core::util; let salt = util::gen_rand_key(64).unwrap(); let password = "Secret password".as_bytes(); let derived_password = default::pbkdf2(password, &salt, 64);