pub struct TimedArgonParams {
    pub lanes: u32,
    pub ram_per_hasher: u32,
    pub minimum_duration: Duration,
}
Expand description

Automatic configuration based on execution time. This is measured during the first set_password

Fields§

§lanes: u32

The number of lanes (p) that the argon algorithm should use.

§ram_per_hasher: u32

The amount of ram each hashing operation should utilize.

§minimum_duration: Duration

The minimum execution time that hashing a password should consume.

Implementations§

The minimum amount of ram to allocate per hasher. This value is currently 64MB but will change as the minimum recommendations are changed.

Returns the default configuration based on the system information and number of hashers.

  • ram_per_hasher: The total amount of RAM allocated will be the total system memory divided by 16. This allocated amount will be divided equally between the hashers. If this number is less than Self::MINIMUM_RAM_PER_HASHER, Self::MINIMUM_RAM_PER_HASHER will be used instead.

    For example, if 4 hashers are used on a system with 16GB of RAM, a total of 1GB of RAM will be used between 4 hashers, yielding a ram_per_hasher value of 256MB.

  • lanes: defaults to 4.

  • minimum_duration: defaults to 1 second. The RFC suggests 0.5 seconds, but many in the community recommend 1 second.

The strength of Argon2 is derived largely by the amount of RAM dedicated to it, so the largest value acceptable should be chosen for ram_per_hasher. For more guidance on parameter selection, see RFC 9106, section 4 “Parameter Choice”.

Debug Mode

When running with debug_assertions the ram_per_hasher will be set to 32kb. This is due to how slow debug mode is for the hashing algorithm. These settings should not be used in production.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Default Values

When using TimedArgonParams::default(), the settings are 4 lanes, Self::MINIMUM_RAM_PER_HASHER of RAM per hasher, and a minimum duration of 1 second.

The strength of Argon2 is derived largely by the amount of RAM dedicated to it, so the largest value acceptable should be chosen for ram_per_hasher. For more guidance on parameter selection, see RFC 9106, section 4 “Parameter Choice”.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more