pub struct ScryptParams {
pub log_n: u8,
pub r: u32,
pub p: u32,
}Expand description
Parameters for scrypt key derivation.
RFC 7914 recommends log_n=14 (N=16384), r=8, p=1 for interactive
logins and higher values for sensitive use-cases.
Note: log_n encodes N as log₂(N), e.g. log_n=14 means N=16384.
Fields§
§log_n: u8CPU/memory cost factor as log₂(N). N must be a power of 2.
r: u32Block size. RFC 7914 recommends r=8.
p: u32Parallelization factor. RFC 7914 recommends p=1.
Implementations§
Source§impl ScryptParams
impl ScryptParams
Sourcepub fn new(log_n: u8, r: u32, p: u32) -> Result<Self, CryptoError>
pub fn new(log_n: u8, r: u32, p: u32) -> Result<Self, CryptoError>
Create new parameters, returning an error if they are invalid.
Sourcepub fn interactive() -> Self
pub fn interactive() -> Self
Interactive login preset.
N=32768 (log_n=15), r=8, p=1 Provides ≈32 MiB memory and ~100–200 ms on a modern CPU.
Trait Implementations§
Source§impl Clone for ScryptParams
impl Clone for ScryptParams
Source§fn clone(&self) -> ScryptParams
fn clone(&self) -> ScryptParams
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScryptParams
impl Debug for ScryptParams
Source§impl PasswordHashParams for ScryptParams
impl PasswordHashParams for ScryptParams
Source§fn memory_cost(&self) -> Option<u32>
fn memory_cost(&self) -> Option<u32>
Memory cost approximation: 128 × N × r bytes expressed in KiB.
Source§fn time_cost(&self) -> Option<u32>
fn time_cost(&self) -> Option<u32>
Time cost (iterations for PBKDF2/Argon2) or
None if not applicable.Source§fn parallelism(&self) -> Option<u32>
fn parallelism(&self) -> Option<u32>
Degree of parallelism (Argon2/scrypt) or
None if not applicable.impl Copy for ScryptParams
Auto Trait Implementations§
impl Freeze for ScryptParams
impl RefUnwindSafe for ScryptParams
impl Send for ScryptParams
impl Sync for ScryptParams
impl Unpin for ScryptParams
impl UnsafeUnpin for ScryptParams
impl UnwindSafe for ScryptParams
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