Struct argon2rs::Argon2 [] [src]

pub struct Argon2 { /* fields omitted */ }

Main entry point for running Argon2 on customized parameters (cf. note for Argon2::new).

Methods

impl Argon2
[src]

Returns an Argon2 set to default input parameters. See below for a description of these parameters.

Use this to customize Argon2's time and memory cost parameters. Adjusting any of these will affect the value of the final hash result.

passes: The number of block matrix iterations to perform. Increasing this forces hashing to take longer. Must be between 1 and 232 - 1.

lanes: The degree of parallelism by which memory is filled during hash computation. Setting this to N instructs argon2rs to partition the block matrix into N lanes, simultaneously filling each lane in parallel with N threads. Must be between 1 and 224 - 1.

kib: Desired total size of block matrix, in kibibytes (1 KiB = 1024 bytes). Increasing this forces hashing to use more memory in order to thwart ASIC-based attacks. Must be >= 8 * lanes.

variant: Set this to Variant::Argon2i when hashing passwords.

Runs the selected Argon2 variant over provided inputs, writing the final hash to the byte slice out. Note that the output length is assumed to be out.len() and must be between 4 and 232 - 1. The inputs are:

p, the byte slice containing, typically, the plaintext (length 0 to 232-1);

a salt s of length 8 to 232 - 1 bytes;

k, an optional (length 0 to 32 bytes) secret value; and

x, optional associated data length 0 to 232 - 1.

Provides read-only access to (variant, kibibytes, passes, lanes, version). The version should always be 0x13.