pub struct Keccak {}
Expand description

Naive Keccak structure

Implementations§

source§

impl Keccak

Trait containing common operations for optimized Keccak

source

pub fn compose(quarters: &[u64]) -> u64

Composes a vector of 4 dense quarters into the dense full u64 word

source

pub fn decompose(word: u64) -> Vec<u64>

Takes a dense u64 word and decomposes it into a vector of 4 dense quarters. The first element of the vector corresponds to the 16 least significant bits.

source

pub fn expand(quarter: u64) -> u64

Expands a quarter of a word into the sparse representation as a u64

source

pub fn expand_word<F: PrimeField, T: ExprOps<F>>(word: u64) -> Vec<T>

Expands a u64 word into a vector of 4 sparse u64 quarters

source

pub fn sparse(word: u64) -> Vec<u64>

Returns the expansion of the 4 dense decomposed quarters of a word where the first expanded element corresponds to the 16 least significant bits of the word.

source

pub fn shift(state: &[u64]) -> Vec<u64>

From each quarter in sparse representation, it computes its 4 resets. The resulting vector contains 4 times as many elements as the input. The output is placed in the vector as [shift0, shift1, shift2, shift3]

source

pub fn reset(shifts: &[u64]) -> Vec<u64>

From a vector of shifts, resets the underlying value returning only shift0 Note that shifts is always a vector whose length is a multiple of 4.

source

pub fn collapse(state: &[u64]) -> Vec<u64>

From a canonical expanded state, obtain the corresponding 16-bit dense terms

source

pub fn quarters(state: &[u8]) -> Vec<u64>

Outputs the state into dense quarters of 16-bits each in little endian order

source

pub fn bytestring(dense: &[u64]) -> Vec<u64>

On input a vector of 16-bit dense quarters, outputs a vector of 8-bit bytes in the right order for Keccak

source

pub fn expand_state(state: &[u8]) -> Vec<u64>

On input a 200-byte vector, generates a vector of 100 expanded quarters representing the 1600-bit state

source

pub fn padded_length(bytelength: usize) -> usize

On input a length, returns the smallest multiple of RATE_IN_BYTES that is greater than the bytelength. That means that if the input has a length that is a multiple of the RATE_IN_BYTES, then it needs to add one whole block of RATE_IN_BYTES bytes just for padding purposes.

source

pub fn pad(message: &[u8]) -> Vec<u8>

Pads the message with the 10*1 rule until reaching a length that is a multiple of the rate

source

pub fn num_blocks(bytelength: usize) -> usize

Number of blocks to be absorbed on input a given preimage bytelength

Auto Trait Implementations§

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V