Skip to main content
This is unreleased documentation for the main (development) branch of crypto-glue.

pbkdf2_hmac_array

Function pbkdf2_hmac_array 

Source
pub fn pbkdf2_hmac_array<D, const N: usize>(
    password: &[u8],
    salt: &[u8],
    rounds: u32,
) -> [u8; N]
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_hmac function which returns an array instead of filling an input slice.

use hex_literal::hex;
use pbkdf2::pbkdf2_hmac_array;
use sha2::Sha256;

assert_eq!(
    pbkdf2_hmac_array::<Sha256, 20>(b"password", b"salt", 600_000),
    hex!("669cfe52482116fda1aa2cbe409b2f56c8e45637"),
);