pub struct Params { /* private fields */ }Expand description
Argon2 password hash parameters.
These are parameters which can be encoded into a PHC hash string.
Implementations
sourceimpl Params
impl Params
sourcepub const DEFAULT_M_COST: u32 = 4_096u32
pub const DEFAULT_M_COST: u32 = 4_096u32
Default memory cost.
sourcepub const MIN_M_COST: u32 = 8u32
pub const MIN_M_COST: u32 = 8u32
Minimum number of memory blocks.
sourcepub const MAX_M_COST: u32 = 268_435_455u32
pub const MAX_M_COST: u32 = 268_435_455u32
Maximum number of memory blocks.
sourcepub const DEFAULT_T_COST: u32 = 3u32
pub const DEFAULT_T_COST: u32 = 3u32
Default number of iterations (i.e. “time”).
sourcepub const MIN_T_COST: u32 = 1u32
pub const MIN_T_COST: u32 = 1u32
Minimum number of passes.
sourcepub const MAX_T_COST: u32 = 4_294_967_295u32
pub const MAX_T_COST: u32 = 4_294_967_295u32
Maximum number of passes.
sourcepub const DEFAULT_P_COST: u32 = 1u32
pub const DEFAULT_P_COST: u32 = 1u32
Default degree of parallelism.
sourcepub const MIN_P_COST: u32 = 1u32
pub const MIN_P_COST: u32 = 1u32
Minimum and maximum number of threads (i.e. parallelism).
sourcepub const MAX_P_COST: u32 = 16_777_215u32
pub const MAX_P_COST: u32 = 16_777_215u32
Minimum and maximum number of threads (i.e. parallelism).
sourcepub const MAX_KEYID_LEN: usize = 8usize
pub const MAX_KEYID_LEN: usize = 8usize
Maximum length of a key ID in bytes.
sourcepub const MAX_DATA_LEN: usize = 32usize
pub const MAX_DATA_LEN: usize = 32usize
Maximum length of associated data in bytes.
sourcepub const DEFAULT_OUTPUT_LEN: usize = 32usize
pub const DEFAULT_OUTPUT_LEN: usize = 32usize
Default output length.
sourcepub const MIN_OUTPUT_LEN: usize = 4usize
pub const MIN_OUTPUT_LEN: usize = 4usize
Minimum digest size in bytes.
sourcepub const MAX_OUTPUT_LEN: usize = 4_294_967_295usize
pub const MAX_OUTPUT_LEN: usize = 4_294_967_295usize
Maximum digest size in bytes.
sourcepub fn new(
m_cost: u32,
t_cost: u32,
p_cost: u32,
output_len: Option<usize>
) -> Result<Self>
pub fn new(
m_cost: u32,
t_cost: u32,
p_cost: u32,
output_len: Option<usize>
) -> Result<Self>
Create new parameters.
sourcepub fn m_cost(&self) -> u32
pub fn m_cost(&self) -> u32
Memory size, expressed in kilobytes, between 1 and (2^32)-1.
Value is an integer in decimal (1 to 10 digits).
sourcepub fn t_cost(&self) -> u32
pub fn t_cost(&self) -> u32
Number of iterations, between 1 and (2^32)-1.
Value is an integer in decimal (1 to 10 digits).
sourcepub fn p_cost(&self) -> u32
pub fn p_cost(&self) -> u32
Degree of parallelism, between 1 and 255.
Value is an integer in decimal (1 to 3 digits).
sourcepub fn keyid(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[u8]
pub fn keyid(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[u8]
Key identifier: byte slice between 0 and 8 bytes in length.
Defaults to an empty byte slice.
Note this field is only present as a helper for reading/storing in the PHC hash string format (i.e. it is totally ignored from a cryptographical standpoint).
On top of that, this field is not longer part of the argon2 standard (see: https://github.com/P-H-C/phc-winner-argon2/pull/173), and should not be used for any non-legacy work.
sourcepub fn data(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[u8]
pub fn data(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[u8]
Associated data: byte slice between 0 and 32 bytes in length.
Defaults to an empty byte slice.
This field is not longer part of the argon2 standard (see: https://github.com/P-H-C/phc-winner-argon2/pull/173), and should not be used for any non-legacy work.
sourcepub fn output_len(&self) -> Option<usize>
pub fn output_len(&self) -> Option<usize>
Length of the output (in bytes).
sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Get the number of blocks required given the configured m_cost and p_cost.
Trait Implementations
sourceimpl<'a> TryFrom<&'a PasswordHash<'a>> for Params
Available on crate feature password-hash only.
impl<'a> TryFrom<&'a PasswordHash<'a>> for Params
password-hash only.sourceimpl<'a> TryFrom<&Params> for ParamsString
Available on crate feature password-hash only.
impl<'a> TryFrom<&Params> for ParamsString
password-hash only.sourceimpl<'a> TryFrom<Params> for ParamsString
Available on crate feature password-hash only.
impl<'a> TryFrom<Params> for ParamsString
password-hash only.sourceimpl TryFrom<ParamsBuilder> for Params
impl TryFrom<ParamsBuilder> for Params
impl Eq for Params
impl StructuralEq for Params
impl StructuralPartialEq for Params
Auto Trait Implementations
impl RefUnwindSafe for Params
impl Send for Params
impl Sync for Params
impl Unpin for Params
impl UnwindSafe for Params
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more