pub struct Params { /* private fields */ }Expand description
The Scrypt parameter values.
Implementations§
Source§impl Params
impl Params
Sourcepub const RECOMMENDED_LOG_N: u8 = 17u8
pub const RECOMMENDED_LOG_N: u8 = 17u8
Recommended log₂ of the Scrypt parameter N: CPU/memory cost.
Sourcepub const RECOMMENDED_R: u32 = 8u32
pub const RECOMMENDED_R: u32 = 8u32
Recommended Scrypt parameter r: block size.
Sourcepub const RECOMMENDED_P: u32 = 1u32
pub const RECOMMENDED_P: u32 = 1u32
Recommended Scrypt parameter p: parallelism.
Sourcepub const RECOMMENDED_LEN: usize = 32usize
pub const RECOMMENDED_LEN: usize = 32usize
Recommended Scrypt parameter Key length.
Sourcepub fn new_with_output_len(
log_n: u8,
r: u32,
p: u32,
len: usize,
) -> Result<Params, InvalidParams>
Available on crate feature password-hash only.
pub fn new_with_output_len( log_n: u8, r: u32, p: u32, len: usize, ) -> Result<Params, InvalidParams>
password-hash only.Create a new instance of Params, overriding the output length.
Note that this length is only intended for use with the PasswordHasher API, and not with
the low-level scrypt::scrypt API, which determines the output length
using the size of the output slice.
The allowed values for len are between 10 bytes (80 bits) and 64 bytes inclusive.
These lengths come from the PHC string format specification
because they are intended for use with password hash strings.
Sourcepub const fn recommended() -> Params
pub const fn recommended() -> Params
Recommended values according to the OWASP cheat sheet
log_n = 17(n = 131072)r = 8p = 1
Sourcepub const fn log_n(&self) -> u8
pub const fn log_n(&self) -> u8
log₂ of the Scrypt parameter N, the work factor.
Memory and CPU usage scale linearly with N. If you need N, use
Params::n instead.
Sourcepub const fn n(&self) -> u64
pub const fn n(&self) -> u64
N parameter: the work factor.
This method returns 2 to the power of Params::log_n. Memory and CPU
usage scale linearly with N.
Trait Implementations§
Source§impl<'a> TryFrom<&'a PasswordHash<'a>> for Params
Available on crate feature simple only.
impl<'a> TryFrom<&'a PasswordHash<'a>> for Params
simple only.Source§impl TryFrom<Params> for ParamsString
Available on crate feature simple only.
impl TryFrom<Params> for ParamsString
simple only.