pub struct PassphraseParams { /* private fields */ }Expand description
How much work deriving a key from a passphrase takes: the memory, iterations and lanes of Argon2id.
In CBOR, the parameters are the array [1, memory, iterations, lanes], with the memory
in KiB.
Implementations§
Source§impl PassphraseParams
impl PassphraseParams
Sourcepub const RECOMMENDED: PassphraseParams
pub const RECOMMENDED: PassphraseParams
RFC 9106’s first recommendation, for devices with enough memory: 2 GiB, one iteration and four lanes.
Sourcepub const LOW_MEMORY: PassphraseParams
pub const LOW_MEMORY: PassphraseParams
RFC 9106’s second recommendation, for devices with little memory: 64 MiB, three iterations and four lanes.
Sourcepub fn new(
memory_kib: u32,
iterations: u32,
lanes: u32,
) -> Result<PassphraseParams, CryptoError>
pub fn new( memory_kib: u32, iterations: u32, lanes: u32, ) -> Result<PassphraseParams, CryptoError>
Returns the parameters, with the memory in KiB.
§Errors
Returns CryptoError::Passphrase unless there are 1 to 16 iterations and 1 to 16
lanes, and the memory is at least 8 KiB per lane, as Argon2 requires, and at most
4 GiB. The upper limits keep a damaged or hostile record from making a device
allocate unlimited memory or work for ever.
Sourcepub const fn memory_kib(self) -> u32
pub const fn memory_kib(self) -> u32
The memory, in KiB.
Sourcepub const fn iterations(self) -> u32
pub const fn iterations(self) -> u32
The number of iterations.
Trait Implementations§
Source§impl Clone for PassphraseParams
impl Clone for PassphraseParams
Source§fn clone(&self) -> PassphraseParams
fn clone(&self) -> PassphraseParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PassphraseParams
Source§impl Debug for PassphraseParams
impl Debug for PassphraseParams
impl Eq for PassphraseParams
Source§impl FromCbor for PassphraseParams
impl FromCbor for PassphraseParams
Source§impl Hash for PassphraseParams
impl Hash for PassphraseParams
Source§impl PartialEq for PassphraseParams
impl PartialEq for PassphraseParams
impl StructuralPartialEq for PassphraseParams
Auto Trait Implementations§
impl Forget for PassphraseParams
impl Freeze for PassphraseParams
impl Move for PassphraseParams
impl RefUnwindSafe for PassphraseParams
impl Send for PassphraseParams
impl Sync for PassphraseParams
impl Unpin for PassphraseParams
impl UnsafeUnpin for PassphraseParams
impl UnwindSafe for PassphraseParams
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key and return true if they are equal.