pub fn pbkdf2_hmac<D>(password: &[u8], salt: &[u8], rounds: u32, res: &mut [u8])where
D: CoreProxy,
D::Core: Sync + HashMarker + UpdateCore + FixedOutputCore + BufferKindUser<BufferKind = Eager> + Default + Clone,
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
Expand description
A variant of the pbkdf2
function which uses HMAC for PRF.
It’s generic over (eager) hash functions.
use hex_literal::hex;
use pbkdf2::pbkdf2_hmac;
use sha2::Sha256;
let mut buf = [0u8; 20];
pbkdf2_hmac::<Sha256>(b"password", b"salt", 600_000, &mut buf);
assert_eq!(buf, hex!("669cfe52482116fda1aa2cbe409b2f56c8e45637"));