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(log_n: u8, r: u32, p: u32, len: usize) -> Result<Params, InvalidParams>
pub fn new(log_n: u8, r: u32, p: u32, len: usize) -> Result<Params, InvalidParams>
Create a new instance of Params
.
Arguments
log_n
- The log₂ of the Scrypt parameterN
r
- The Scrypt parameterr
p
- The Scrypt parameterp
len
- The Scrypt parameterKey length
Conditions
log_n
must be less than64
r
must be greater than0
and less than or equal to4294967295
p
must be greater than0
and less than4294967295
len
must be greater than9
and less than or equal to64
sourcepub fn recommended() -> Params
pub fn recommended() -> Params
Recommended values sufficient for most use-cases
log_n = 15
(n = 32768
)r = 8
p = 1
sourcepub fn log_n(&self) -> u8
pub fn log_n(&self) -> u8
log₂ of the Scrypt parameter N
, the work factor.
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
Available on crate feature
simple
only.source§impl TryFrom<Params> for ParamsString
Available on crate feature simple
only.
impl TryFrom<Params> for ParamsString
Available on crate feature
simple
only.