Argon2_Context

Struct Argon2_Context 

Source
#[repr(C)]
pub struct Argon2_Context {
Show 18 fields pub out: *mut u8, pub outlen: u32, pub pwd: *mut u8, pub pwdlen: u32, pub salt: *mut u8, pub saltlen: u32, pub secret: *mut u8, pub secretlen: u32, pub ad: *mut u8, pub adlen: u32, pub t_cost: u32, pub m_cost: u32, pub lanes: u32, pub threads: u32, pub version: u32, pub allocate_cbk: allocate_fptr, pub free_cbk: deallocate_fptr, pub flags: u32,
}
Expand description

Context: structure to hold 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. You want to use the default memory allocator. Then you initialize: Argon2_Context(out,8,pwd,32,salt,16,NULL,0,NULL,0,5,1<<20,4,4,NULL,NULL,true,false,false,false)

Fields§

§out: *mut u8§outlen: u32§pwd: *mut u8§pwdlen: u32§salt: *mut u8§saltlen: u32§secret: *mut u8§secretlen: u32§ad: *mut u8§adlen: u32§t_cost: u32§m_cost: u32§lanes: u32§threads: u32§version: u32§allocate_cbk: allocate_fptr§free_cbk: deallocate_fptr§flags: u32

Trait Implementations§

Source§

impl Clone for Argon2_Context

Source§

fn clone(&self) -> Argon2_Context

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Argon2_Context

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for Argon2_Context

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.