Struct argon2_sys::Argon2_Context[][src]

#[repr(C)]
pub struct Argon2_Context {
Show 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 u8outlen: u32pwd: *mut u8pwdlen: u32salt: *mut u8saltlen: u32secret: *mut u8secretlen: u32ad: *mut u8adlen: u32t_cost: u32m_cost: u32lanes: u32threads: u32version: u32allocate_cbk: allocate_fptrfree_cbk: deallocate_fptrflags: u32

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.