Enum hc_seed_bundle::PwHashLimits
source · pub enum PwHashLimits {
Minimum,
Interactive,
Moderate,
Sensitive,
}
Expand description
Enum to specify limits (difficulty) for argon2id pwhashing algorithm.
Ops in this library don’t take explicit limit parameters. Instead, they check the current context, if not set using the default “Moderate” limits.
To set the context for the scope of the “with_exec” callback:
let _my_result = PwHashLimits::Sensitive.with_exec(|| {
// execute my function that needs "Sensitive" limits
});
Variants§
Minimum
minimum limits (UNIT TESTING ONLY)
Interactive
low cpu/mem limits
Moderate
middle cpu/mem limits (default)
Sensitive
high cpu/mem limits
Implementations§
source§impl PwHashLimits
impl PwHashLimits
sourcepub fn current() -> Self
pub fn current() -> Self
Get the current set limits
or the default “Moderate” limits if none are set by with_exec()
.
sourcepub fn with_exec<R, F>(self, f: F) -> Rwhere
F: FnOnce() -> R,
pub fn with_exec<R, F>(self, f: F) -> Rwhere
F: FnOnce() -> R,
Execute a closure with these pwhash limits set.
sourcepub fn as_mem_limit(&self) -> u32
pub fn as_mem_limit(&self) -> u32
translate into mem limit
sourcepub fn as_ops_limit(&self) -> u32
pub fn as_ops_limit(&self) -> u32
translate into cpu limit
Trait Implementations§
source§impl Clone for PwHashLimits
impl Clone for PwHashLimits
source§fn clone(&self) -> PwHashLimits
fn clone(&self) -> PwHashLimits
Returns a copy of the value. Read more
1.0.0 · 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 PwHashLimits
impl Debug for PwHashLimits
source§impl PartialEq for PwHashLimits
impl PartialEq for PwHashLimits
source§fn eq(&self, other: &PwHashLimits) -> bool
fn eq(&self, other: &PwHashLimits) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for PwHashLimits
impl Eq for PwHashLimits
impl StructuralPartialEq for PwHashLimits
Auto Trait Implementations§
impl RefUnwindSafe for PwHashLimits
impl Send for PwHashLimits
impl Sync for PwHashLimits
impl Unpin for PwHashLimits
impl UnwindSafe for PwHashLimits
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.