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 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_with_output_len(
log_n: u8,
r: u32,
p: u32,
len: usize,
) -> Result<Params, InvalidParams>
Available on crate feature phc only.
pub fn new_with_output_len( log_n: u8, r: u32, p: u32, len: usize, ) -> Result<Params, InvalidParams>
phc 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
👎Deprecated since 0.12.0: use Params::RECOMMENDED instead
pub const fn recommended() -> Params
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§
Source§impl TryFrom<&Params> for ParamsString
Available on crate feature phc only.
impl TryFrom<&Params> for ParamsString
phc only.Source§impl TryFrom<&ParamsString> for Params
Available on crate feature phc only.
impl TryFrom<&ParamsString> for Params
phc only.Source§impl TryFrom<&PasswordHash> for Params
Available on crate feature phc only.
impl TryFrom<&PasswordHash> for Params
phc only.Source§impl TryFrom<Params> for ParamsString
Available on crate feature phc only.
impl TryFrom<Params> for ParamsString
phc only.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 UnwindSafe for Params
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more