Struct argon2::Config

source ·
pub struct Config<'a> {
    pub ad: &'a [u8],
    pub hash_length: u32,
    pub lanes: u32,
    pub mem_cost: u32,
    pub secret: &'a [u8],
    pub thread_mode: ThreadMode,
    pub time_cost: u32,
    pub variant: Variant,
    pub version: Version,
}
Expand description

Structure containing configuration settings.

Examples

use argon2::{Config, ThreadMode, Variant, Version};

let config = Config::default();
assert_eq!(config.ad, &[]);
assert_eq!(config.hash_length, 32);
assert_eq!(config.lanes, 1);
assert_eq!(config.mem_cost, 4096);
assert_eq!(config.secret, &[]);
assert_eq!(config.thread_mode, ThreadMode::Sequential);
assert_eq!(config.time_cost, 3);
assert_eq!(config.variant, Variant::Argon2i);
assert_eq!(config.version, Version::Version13);

Fields§

§ad: &'a [u8]

The associated data.

§hash_length: u32

The length of the resulting hash.

§lanes: u32

The number of lanes.

§mem_cost: u32

The amount of memory requested (KB).

§secret: &'a [u8]

The key.

§thread_mode: ThreadMode

The thread mode.

§time_cost: u32

The number of passes.

§variant: Variant

The variant.

§version: Version

The version number.

Implementations§

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
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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.

Calls U::from(self).

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

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.