Struct argon2::Argon2 [−][src]
Argon2 context.
Holds the following Argon2 inputs:
- output array and its length,
- password and its length,
- salt and its length,
- secret and its length,
- associated data and its length,
- number of passes, amount of used memory (in KBytes, can be rounded up a bit)
- number of parallel threads that will be run.
All the parameters above affect the output hash value. Additionally, two function pointers can be provided to allocate and deallocate the memory (if NULL, memory will be allocated internally). Also, three flags indicate whether to erase password, secret as soon as they are pre-hashed (and thus not needed anymore), and the entire memory
Simplest situation: you have output array out[8]
, password is stored in
pwd[32]
, salt is stored in salt[16]
, you do not have keys nor associated
data.
You need to spend 1 GB of RAM and you run 5 passes of Argon2d with 4 parallel lanes.
You want to erase the password, but you're OK with last pass not being erased.
Implementations
impl<'key> Argon2<'key>
[src]
pub fn new(
secret: Option<&'key [u8]>,
t_cost: u32,
m_cost: u32,
parallelism: u32,
version: Version
) -> Result<Self, Error>
[src]
secret: Option<&'key [u8]>,
t_cost: u32,
m_cost: u32,
parallelism: u32,
version: Version
) -> Result<Self, Error>
Create a new Argon2 context
pub fn hash_password_into(
&self,
alg: Algorithm,
pwd: &[u8],
salt: &[u8],
ad: &[u8],
out: &mut [u8]
) -> Result<(), Error>
[src]
&self,
alg: Algorithm,
pwd: &[u8],
salt: &[u8],
ad: &[u8],
out: &mut [u8]
) -> Result<(), Error>
Hash a password and associated parameters into the provided output buffer.
Trait Implementations
impl<'key> Clone for Argon2<'key>
[src]
impl Default for Argon2<'_>
[src]
impl PasswordHasher for Argon2<'_>
[src]
password-hash
only.type Params = Params
Algorithm-specific parameters.
fn hash_password<'a>(
&self,
password: &[u8],
alg_id: Option<Ident<'a>>,
version_id: Option<Decimal>,
params: Params,
salt: Salt<'a>
) -> Result<PasswordHash<'a>, HasherError>
[src]
&self,
password: &[u8],
alg_id: Option<Ident<'a>>,
version_id: Option<Decimal>,
params: Params,
salt: Salt<'a>
) -> Result<PasswordHash<'a>, HasherError>
pub fn hash_password_simple(
&self,
password: &[u8],
salt: &'a str
) -> Result<PasswordHash<'a>, HasherError>
[src]
&self,
password: &[u8],
salt: &'a str
) -> Result<PasswordHash<'a>, HasherError>
Auto Trait Implementations
impl<'key> RefUnwindSafe for Argon2<'key>
[src]
impl<'key> Send for Argon2<'key>
[src]
impl<'key> Sync for Argon2<'key>
[src]
impl<'key> Unpin for Argon2<'key>
[src]
impl<'key> UnwindSafe for Argon2<'key>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> PasswordVerifier for T where
T: PasswordHasher,
[src]
T: PasswordHasher,
pub fn verify_password(
&self,
password: &[u8],
hash: &PasswordHash<'_>
) -> Result<(), VerifyError>
[src]
&self,
password: &[u8],
hash: &PasswordHash<'_>
) -> Result<(), VerifyError>
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,