Function orion::default::pbkdf2_verify[][src]

pub fn pbkdf2_verify(
    expected_dk: &[u8],
    password: &[u8]
) -> Result<bool, ValidationCryptoError>

Verify PBKDF2-HMAC-SHA512 derived key in constant time.

About:

This function is meant to be used with the default::pbkdf2() function in orion's default API. It can be used without it, but then the expected_dk passed to the function must be constructed just as in default::pbkdf2(). See documention on default::pbkdf2() for details on this.

Exceptions:

An exception will be thrown if:

  • The length of expected_dk is not 64 bytes.

Example:

use orion::default;

let password = "Secret password".as_bytes();

let derived_password = default::pbkdf2(password).unwrap();
assert_eq!(default::pbkdf2_verify(&derived_password, password).unwrap(), true);