# Function ring::pbkdf2::derive [−] [src]

    pub fn derive(
        digest_alg: &'static Algorithm,
        iterations: u32,
        salt: &[u8],
        secret: &[u8],
        out: &mut [u8]
    )

Fills `out` with the key derived using PBKDF2 with the given inputs.

Do not use `derive` as part of verifying a secret; use `verify` instead, to minimize the effectiveness of timing attacks.

`out.len()` must be no larger than the digest length * (2**32 - 1), per the PBKDF2 specification.

Parameter | RFC 2898 Section 5.2 Term
--- | ---
digest_alg | PRF (HMAC with the given digest algorithm)
iterations | c (iteration count)
salt | S (salt)
secret | P (password)
out | dk (derived key)
out.len() | dkLen (derived key length)

C analog: `PKCS5_PBKDF2_HMAC`

# Panics

`derive` panics if `iterations < 1`.

`derive` panics if `out.len()` is larger than (2**32 - 1) * the digest algorithm's output length, per the PBKDF2 specification.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)