Struct ascon::State

source ·
pub struct State { /* private fields */ }
Expand description

The state of Ascon’s permutation.

The permutation operates on a state of 320 bits represented as 5 64 bit words.

Implementations§

source§

impl State

source

pub fn new(x0: u64, x1: u64, x2: u64, x3: u64, x4: u64) -> Self

Instantiate new state from the given values.

source

pub fn permute_12(&mut self)

Available on non-crate feature no_unroll only.

Perform permutation with 12 rounds.

source

pub fn permute_8(&mut self)

Available on non-crate feature no_unroll only.

Perform permutation with 8 rounds.

source

pub fn permute_6(&mut self)

Available on non-crate feature no_unroll only.

Perform permutation with 6 rounds.

source

pub fn permute_1(&mut self)

Perform permutation with 1 round

source

pub fn permute_n(&mut self, rounds: usize)

Perform a given number (up to 12) of permutations

Panics (in debug mode) if rounds is larger than 12.

source

pub fn as_bytes(&self) -> [u8; 40]

Convert state to bytes.

Trait Implementations§

source§

impl AsRef<[u64]> for State

source§

fn as_ref(&self) -> &[u64]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for State

source§

fn clone(&self) -> State

Returns a copy 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 State

source§

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

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

impl Default for State

source§

fn default() -> State

Returns the “default value” for a type. Read more
source§

impl From<&[u64; 5]> for State

source§

fn from(value: &[u64; 5]) -> Self

Converts to this type from the input type.
source§

impl From<&[u8; 40]> for State

source§

fn from(value: &[u8; 40]) -> Self

Converts to this type from the input type.
source§

impl Index<usize> for State

§

type Output = u64

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for State

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl TryFrom<&[u64]> for State

§

type Error = ()

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

fn try_from(value: &[u64]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&[u8]> for State

§

type Error = ()

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

fn try_from(value: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnwindSafe for State

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.