pub fn pbkdf2_into<H: Hash>(
password: &[u8],
salt: impl Salt<NonEmpty>,
iters: Iters,
out_key: &mut [u8],
) -> Result<(), Unspecified>Expand description
Performs PBKDF2 and writes the result into the provided out_key buffer.
§Arguments
password- The password to use for the key derivation.salt- The salt to use for key derivation.iters- The number of times to process the hash.out_key- The buffer to write the generated key into.
§Errors
- The length of the
passwordwas greater thani32::MAX. - The length of the
saltwas greater thani32::MAX. - The number of
iterswas greater thani32::MAX. - The length of the
out_keywas greater thani32::MAX.
§FIPS Errors
If the allow-non-fips feature flag is disabled this will return an error if the out_key
length is not at least FIPS_MIN_KEY (14 bytes).
§Example
use wolf_crypto::kdf::{pbkdf2_into, Sha256, Iters};
let password = b"my secret password";
let salt = [42; 16];
let iters = Iters::new(600_000).unwrap();
let mut out_key = [0u8; 32];
pbkdf2_into::<Sha256>(password, salt, iters, out_key.as_mut_slice()).unwrap();