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 parameterNr- The Scrypt parameterrp- The Scrypt parameterplen- The Scrypt parameterKey length
§Conditions
log_nmust be less than64rmust be greater than0and less than or equal to4294967295pmust be greater than0and less than4294967295lenmust be greater than9and 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 = 8p = 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.impl Copy for Params
Auto Trait Implementations§
impl Freeze for Params
impl RefUnwindSafe for Params
impl Send for Params
impl Sync for Params
impl Unpin for Params
impl UnwindSafe for Params
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more