Function scrypt

Source
pub fn scrypt(
    password: &[u8],
    salt: &[u8],
    params: &Params,
    output: &mut [u8],
) -> Result<(), InvalidOutputLen>
Expand description

The scrypt key derivation function.

§Arguments

  • password - The password to process as a byte vector
  • salt - The salt value to use as a byte vector
  • params - The ScryptParams to use
  • output - The resulting derived key is returned in this byte vector. WARNING: Make sure to compare this value in constant time!

§Return

Ok(()) if calculation is successful and Err(InvalidOutputLen) if output does not satisfy the following condition: output.len() > 0 && output.len() <= (2^32 - 1) * 32.

§Note about output lengths

The output size is determined entirely by size of the output parameter.

If the length of the Params have been customized using the Params::new_with_output_len constructor, that length is ignored and the length of output is used instead.