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

pbkdf2_hmac

Function pbkdf2_hmac 

Source
pub fn pbkdf2_hmac<D: EagerHash>(
    password: &[u8],
    salt: &[u8],
    rounds: u32,
    res: &mut [u8],
)
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, sha2::Sha256};

let mut buf = [0u8; 20];
pbkdf2_hmac::<Sha256>(b"password", b"salt", 600_000, &mut buf);
assert_eq!(buf, hex!("669cfe52482116fda1aa2cbe409b2f56c8e45637"));