pub fn pbkdf1<const KL: usize, H: Hash>(
password: &[u8],
salt: impl Salt<NonEmpty>,
iters: Iters,
) -> Result<[u8; KL], Unspecified>Available on crate feature
allow-non-fips only.Expand description
Performs PBKDF1 and returns the result as a fixed-size array.
§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.
§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
KLgeneric was greater thani32::MAX.
§Example
use wolf_crypto::kdf::{pbkdf1, Sha256, Iters};
let password = b"my secret password";
let salt = [42; 16];
let iters = Iters::new(600_000).unwrap();
let key = pbkdf1::<32, Sha256>(password, salt, iters).unwrap();
assert_eq!(key.len(), 32);