pbkdf2

Function pbkdf2_hmac_array

Source
pub fn pbkdf2_hmac_array<D, const N: usize>(
    password: &[u8],
    salt: &[u8],
    rounds: u32,
) -> [u8; N]
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"),
);