Struct 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)

Perform permutation with 12 rounds.

Source

pub fn permute_8(&mut self)

Perform permutation with 8 rounds.

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

Source§

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

Source§

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

Source§

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 Freeze for State

§

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