pub struct Params { /* private fields */ }Expand description
The Scrypt parameter values.
Implementations§
Source§impl Params
impl Params
Sourcepub const RECOMMENDED_LOG_N: u8 = 17
pub const RECOMMENDED_LOG_N: u8 = 17
Recommended log₂ of the Scrypt parameter N: CPU/memory cost.
Sourcepub const RECOMMENDED_R: u32 = 8
pub const RECOMMENDED_R: u32 = 8
Recommended Scrypt parameter r: block size.
Sourcepub const RECOMMENDED_P: u32 = 1
pub const RECOMMENDED_P: u32 = 1
Recommended Scrypt parameter p: parallelism.
Sourcepub const RECOMMENDED_LEN: usize = 32
pub const RECOMMENDED_LEN: usize = 32
Recommended Scrypt parameter Key length.
Sourcepub const RECOMMENDED: Self
pub const RECOMMENDED: Self
Recommended values according to the OWASP cheat sheet.
log_n = 17(n = 131072)r = 8p = 1
Sourcepub fn new(log_n: u8, r: u32, p: u32) -> Result<Params, InvalidParams>
pub fn new(log_n: u8, r: u32, p: u32) -> Result<Params, InvalidParams>
Create a new instance of Params.
§Arguments
log_n- The log₂ of the Scrypt parameterNr- The Scrypt parameterrp- The Scrypt parameterp
§Conditions
log_nmust be less than64rmust be greater than0and less than or equal to4294967295pmust be greater than0and less than4294967295
§Errors
Returns InvalidParams if one of the parameters is incorrect.
Sourcepub const fn recommended() -> Params
👎Deprecated since 0.12.0: use Params::RECOMMENDED instead
pub const fn recommended() -> Params
use Params::RECOMMENDED instead
Deprecated: recommended values according to the OWASP cheat sheet.
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§
impl Copy for Params
impl StructuralPartialEq 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 UnsafeUnpin 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