pub struct Keccak<const TYPE: u8, const VARIANT: usize>;
Expand description

The sponge construction Sponge[f, pad, r] is a function that takes a variable-length input and produces a fixed-length output (the hash value).

The permutation f is a function that takes a fixed-length input and produces a fixed-length output, defined as f = Keccak-f[b], where b := 25 * 2^l is the width of the permutation, and l is the log width of the permutation. For our case, l = 6, thus b = 1600.

The padding rule pad is a function that takes a variable-length input and produces a fixed-length output. In Keccak, pad is a multi-rate padding, defined as pad(M) = M || 0x01 || 0x00…0x00 || 0x80, where M is the input data, and 0x01 || 0x00…0x00 || 0x80 is the padding. In SHA-3, pad is a SHAKE, defined as pad(M) = M || 0x06 || 0x00…0x00 || 0x80, where M is the input data, and 0x06 || 0x00…0x00 || 0x80 is the padding.

The bitrate r is the number of bits that are absorbed into the sponge state in each iteration of the absorbing phase.

In addition, the capacity is defined as c := b - r.

Trait Implementations§

source§

impl<const TYPE: u8, const VARIANT: usize> Clone for Keccak<TYPE, VARIANT>

source§

fn clone(&self) -> Keccak<TYPE, VARIANT>

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<const TYPE: u8, const VARIANT: usize> Debug for Keccak<TYPE, VARIANT>

source§

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

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

impl<const TYPE: u8, const VARIANT: usize> Default for Keccak<TYPE, VARIANT>

source§

fn default() -> Keccak<TYPE, VARIANT>

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

impl<const TYPE: u8, const VARIANT: usize> Hash for Keccak<TYPE, VARIANT>

source§

fn hash(&self, input: &[Self::Input]) -> Result<Self::Output>

Returns the Keccak hash of the given input as bits.

§

type Input = bool

§

type Output = Vec<bool>

source§

impl<const TYPE: u8, const VARIANT: usize> PartialEq for Keccak<TYPE, VARIANT>

source§

fn eq(&self, other: &Keccak<TYPE, VARIANT>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const TYPE: u8, const VARIANT: usize> Copy for Keccak<TYPE, VARIANT>

source§

impl<const TYPE: u8, const VARIANT: usize> StructuralPartialEq for Keccak<TYPE, VARIANT>

Auto Trait Implementations§

§

impl<const TYPE: u8, const VARIANT: usize> RefUnwindSafe for Keccak<TYPE, VARIANT>

§

impl<const TYPE: u8, const VARIANT: usize> Send for Keccak<TYPE, VARIANT>

§

impl<const TYPE: u8, const VARIANT: usize> Sync for Keccak<TYPE, VARIANT>

§

impl<const TYPE: u8, const VARIANT: usize> Unpin for Keccak<TYPE, VARIANT>

§

impl<const TYPE: u8, const VARIANT: usize> UnwindSafe for Keccak<TYPE, VARIANT>

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V