Struct argon2::Argon2[][src]

pub struct Argon2<'key> { /* fields omitted */ }

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]

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]

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]

This is supported on crate feature password-hash only.

type Params = Params

Algorithm-specific parameters.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> PasswordVerifier for T where
    T: PasswordHasher
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.