Struct Context

Source
pub struct Context<'o, 'p, 'sa, 'se, 'ad> {
    pub out: &'o mut [u8],
    pub pwd: Option<&'p mut [u8]>,
    pub salt: Option<&'sa mut [u8]>,
    pub secret: Option<&'se mut [u8]>,
    pub ad: Option<&'ad mut [u8]>,
    pub t_cost: u32,
    pub m_cost: u32,
    pub lanes: u32,
    pub threads: u32,
    pub version: Version,
    pub flags: Flags,
}
Expand description

Structure to hold Argon2 inputs.

Fields§

§out: &'o mut [u8]

Output array.

§pwd: Option<&'p mut [u8]>

Password array.

§salt: Option<&'sa mut [u8]>

Salt array.

§secret: Option<&'se mut [u8]>

Secret array.

§ad: Option<&'ad mut [u8]>

Associated data array.

§t_cost: u32

Number of passes.

§m_cost: u32

Amount of memory requested (KB)

§lanes: u32

Number of lanes.

§threads: u32

Maximum number of threads.

§version: Version

Version number.

§flags: Flags

Array of bool options

Implementations§

Source§

impl<'o, 'p, 'sa, 'se, 'ad> Context<'o, 'p, 'sa, 'se, 'ad>

Source

pub const MIN_LANES: u32 = 1u32

Minimum number of lanes (degree of parallelism).

Source

pub const MAX_LANES: u32 = 16_777_215u32

Maximum number of lanes (degree of parallelism).

Source

pub const SYNC_POINTS: u32 = 4u32

Number of synchronization points between lanes per pass.

Source

pub const MIN_THREADS: u32 = 1u32

Minimum number of threads.

Source

pub const MAX_THREADS: u32 = 16_777_215u32

Maximum number of threads.

Source

pub const MIN_OUTLEN: u32 = 4u32

Minimum digest size in bytes.

Source

pub const MAX_OUTLEN: u32 = 4_294_967_295u32

Maximum digest size in bytes.

Source

pub const MIN_TIME: u32 = 1u32

Minimum number of passes.

Source

pub const MAX_TIME: u32 = 4_294_967_295u32

Maximum number of passes.

Source

pub const MIN_PWD_LENGTH: u32 = 0u32

Minimum password length in bytes.

Source

pub const MAX_PWD_LENGTH: u32 = 4_294_967_295u32

Maximum password length in bytes.

Source

pub const MIN_AD_LENGTH: u32 = 0u32

Minimum associated data length in bytes.

Source

pub const MAX_AD_LENGTH: u32 = 4_294_967_295u32

Maximum associated data length in bytes.

Source

pub const MIN_SALT_LENGTH: u32 = 8u32

Minimum salt length in bytes.

Source

pub const MAX_SALT_LENGTH: u32 = 4_294_967_295u32

Maximum salt length in bytes.

Source

pub const MIN_SECRET_LENGTH: u32 = 0u32

Minimum key length in bytes.

Source

pub const MAX_SECRET_LENGTH: u32 = 4_294_967_295u32

Maximum key length in bytes.

Auto Trait Implementations§

§

impl<'o, 'p, 'sa, 'se, 'ad> Freeze for Context<'o, 'p, 'sa, 'se, 'ad>

§

impl<'o, 'p, 'sa, 'se, 'ad> RefUnwindSafe for Context<'o, 'p, 'sa, 'se, 'ad>

§

impl<'o, 'p, 'sa, 'se, 'ad> Send for Context<'o, 'p, 'sa, 'se, 'ad>

§

impl<'o, 'p, 'sa, 'se, 'ad> Sync for Context<'o, 'p, 'sa, 'se, 'ad>

§

impl<'o, 'p, 'sa, 'se, 'ad> Unpin for Context<'o, 'p, 'sa, 'se, 'ad>

§

impl<'o, 'p, 'sa, 'se, 'ad> !UnwindSafe for Context<'o, 'p, 'sa, 'se, 'ad>

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> 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, 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.