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 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
Auto Trait Implementations
impl RefUnwindSafe for Argon2_Context
impl !Send for Argon2_Context
impl !Sync for Argon2_Context
impl Unpin for Argon2_Context
impl UnwindSafe for Argon2_Context
Blanket Implementations
Mutably borrows from an owned value. Read more