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

    pub fn verify(
        digest_alg: &'static Algorithm,
        iterations: u32,
        salt: &[u8],
        secret: &[u8],
        previously_derived: &[u8]
    ) -> Result<(), Unspecified>

Verifies that a previously-derived (e.g., using `derive`) PBKDF2 value matches the PBKDF2 value derived from the other inputs.

The comparison is done in constant time to prevent timing attacks. The comparison will fail if `previously_derived` is empty (has a length of zero).

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)
`previously_derived` | dk (derived key)
`previously_derived.len()` | dkLen (derived key length)

C analog: `PKCS5_PBKDF2_HMAC` + `CRYPTO_memcmp`

# Panics

`verify` panics if `iterations < 1`.

`verify` 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`)