Skip to main content

derive_key

Function derive_key 

Source
pub fn derive_key(
    password: &[u8],
    salt: &[u8],
    secret: &[u8],
    ad: &[u8],
    params: &Params,
) -> Result<Vec<u8>, Argon2Error>
Expand description

Derive a key using Argon2id.

This is the main entry point for Argon2id key derivation.

§Arguments

  • password - The password to hash
  • salt - Salt (recommended 16 bytes)
  • secret - Optional secret key (can be empty)
  • ad - Optional associated data (can be empty)
  • params - Argon2id parameters

§Returns

The derived key as a Vec of length params.tag_length.