pub struct Argon2Parameters {
pub length: u32,
pub lanes: u32,
pub memory: u32,
pub iterations: u32,
/* private fields */
}
Expand description
Parameters used to derive the password into an Argon2 hash.
It is used to derive a password into a keypair. You should use the default, although this may be tweakable by the user in some cases. Once serialized, you can save it along the user information as it is not sensitive data. If the hash should never be computed in a non-threaded environment, you can raise the “lanes” value to enable multi-threading.
Note that calling default()
will also generate a new random salt,
so two calls to default()
will not generate the same structure.
Fields§
§length: u32
Length of the desired hash. Should be 32 in most case.
lanes: u32
Number of parallel jobs to run. Only use if always computed in a multithreaded environment.
memory: u32
Memory used by the algorithm in KiB. Higher is better.
iterations: u32
Number of iterations(time cost). Higher is better.
Implementations§
Source§impl Argon2Parameters
impl Argon2Parameters
Sourcepub fn builder() -> Argon2ParametersBuilder<((), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> Argon2ParametersBuilder<((), (), (), (), (), (), (), (), (), ())>
Create a builder for building Argon2Parameters
.
On the builder, call .length(...)
(optional), .lanes(...)
(optional), .memory(...)
(optional), .iterations(...)
(optional), .variant(...)
(optional), .version(...)
(optional), .dc_version(...)
(optional), .associated_data(...)
(optional), .secret_key(...)
(optional), .salt(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of Argon2Parameters
.
Trait Implementations§
Source§impl Clone for Argon2Parameters
impl Clone for Argon2Parameters
Source§fn clone(&self) -> Argon2Parameters
fn clone(&self) -> Argon2Parameters
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Default for Argon2Parameters
Implements the default parameters.
impl Default for Argon2Parameters
Implements the default parameters.