Function orion::default::pbkdf2[][src]

pub fn pbkdf2(password: &[u8]) -> Result<[u8; 64], UnknownCryptoError>

PBKDF2-HMAC-SHA512. Suitable for password storage.

About:

This is meant to be used for password storage.

  • A salt of 32 bytes is automatically generated.
  • The derived key length is set to 32.
  • 512.000 iterations are used.
  • An array of 64 bytes is returned.

The first 32 bytes of this array is the salt used to derive the key and the last 32 bytes is the actual derived key. When using this function with default::pbkdf2_verify() then the seperation of salt and password are automatically handeled.

Exceptions:

An exception will be thrown if:

  • The length of the password is less than 14 bytes.

Example:

use orion::default;

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

let derived_password = default::pbkdf2(password);