Skip to main content

SerializingStatefulSponge

Struct SerializingStatefulSponge 

Source
pub struct SerializingStatefulSponge<Inner> { /* private fields */ }
Expand description

An adapter that serializes field elements to binary and delegates to an inner StatefulHasher.

This mirrors SerializingHasher’s conversions from fields to bytes/u32/u64 streams, but implements the StatefulHasher interface by delegating to an inner stateful hasher that operates on binary data.

Unlike ChainingHasher (which uses chaining mode H(state || input)), this adapter preserves proper sponge absorption semantics by directly calling the inner hasher’s absorb_into method.

Implementations§

Source§

impl<Inner> SerializingStatefulSponge<Inner>

Source

pub const fn new(inner: Inner) -> SerializingStatefulSponge<Inner>

Trait Implementations§

Source§

impl<F, Inner, T> Alignable<F, T> for SerializingStatefulSponge<Inner>
where F: Field, Inner: Alignable<T, T>,

Source§

const ALIGNMENT: usize

The alignment width in units of Input. Read more
Source§

impl<Inner> Clone for SerializingStatefulSponge<Inner>
where Inner: Clone,

Source§

fn clone(&self) -> SerializingStatefulSponge<Inner>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Inner> Debug for SerializingStatefulSponge<Inner>
where Inner: Debug,

Source§

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

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

impl<F, Inner, const M: usize, const OUT: usize> StatefulHasher<[F; M], [[u32; M]; OUT]> for SerializingStatefulSponge<Inner>
where F: Field, Inner: StatefulHasher<[u32; M], [[u32; M]; OUT]>,

Source§

type State = <Inner as StatefulHasher<[u32; M], [[u32; M]; OUT]>>::State

The internal state type that evolves during absorption.
Source§

fn absorb_into( &self, state: &mut <SerializingStatefulSponge<Inner> as StatefulHasher<[F; M], [[u32; M]; OUT]>>::State, input: impl IntoIterator<Item = [F; M]>, )

Absorb elements into the state with overwrite-mode and zero-padding semantics if applicable.
Source§

fn squeeze( &self, state: &<SerializingStatefulSponge<Inner> as StatefulHasher<[F; M], [[u32; M]; OUT]>>::State, ) -> [[u32; M]; OUT]

Squeeze an output from the current state.
Source§

fn hash_rows<'a>(&self, rows: impl IntoIterator<Item = &'a [Item]>) -> Out
where Item: Copy + 'a, Self::State: Default,

One-shot hash of multiple row slices. Read more
Source§

impl<F, Inner, const M: usize, const OUT: usize> StatefulHasher<[F; M], [[u64; M]; OUT]> for SerializingStatefulSponge<Inner>
where F: Field, Inner: StatefulHasher<[u64; M], [[u64; M]; OUT]>,

Source§

type State = <Inner as StatefulHasher<[u64; M], [[u64; M]; OUT]>>::State

The internal state type that evolves during absorption.
Source§

fn absorb_into( &self, state: &mut <SerializingStatefulSponge<Inner> as StatefulHasher<[F; M], [[u64; M]; OUT]>>::State, input: impl IntoIterator<Item = [F; M]>, )

Absorb elements into the state with overwrite-mode and zero-padding semantics if applicable.
Source§

fn squeeze( &self, state: &<SerializingStatefulSponge<Inner> as StatefulHasher<[F; M], [[u64; M]; OUT]>>::State, ) -> [[u64; M]; OUT]

Squeeze an output from the current state.
Source§

fn hash_rows<'a>(&self, rows: impl IntoIterator<Item = &'a [Item]>) -> Out
where Item: Copy + 'a, Self::State: Default,

One-shot hash of multiple row slices. Read more
Source§

impl<F, Inner, const M: usize, const OUT: usize> StatefulHasher<[F; M], [[u8; M]; OUT]> for SerializingStatefulSponge<Inner>
where F: Field, Inner: StatefulHasher<[u8; M], [[u8; M]; OUT]>,

Source§

type State = <Inner as StatefulHasher<[u8; M], [[u8; M]; OUT]>>::State

The internal state type that evolves during absorption.
Source§

fn absorb_into( &self, state: &mut <SerializingStatefulSponge<Inner> as StatefulHasher<[F; M], [[u8; M]; OUT]>>::State, input: impl IntoIterator<Item = [F; M]>, )

Absorb elements into the state with overwrite-mode and zero-padding semantics if applicable.
Source§

fn squeeze( &self, state: &<SerializingStatefulSponge<Inner> as StatefulHasher<[F; M], [[u8; M]; OUT]>>::State, ) -> [[u8; M]; OUT]

Squeeze an output from the current state.
Source§

fn hash_rows<'a>(&self, rows: impl IntoIterator<Item = &'a [Item]>) -> Out
where Item: Copy + 'a, Self::State: Default,

One-shot hash of multiple row slices. Read more
Source§

impl<F, Inner, const OUT: usize> StatefulHasher<F, [u32; OUT]> for SerializingStatefulSponge<Inner>
where F: Field, Inner: StatefulHasher<u32, [u32; OUT]>,

Source§

type State = <Inner as StatefulHasher<u32, [u32; OUT]>>::State

The internal state type that evolves during absorption.
Source§

fn absorb_into( &self, state: &mut <SerializingStatefulSponge<Inner> as StatefulHasher<F, [u32; OUT]>>::State, input: impl IntoIterator<Item = F>, )

Absorb elements into the state with overwrite-mode and zero-padding semantics if applicable.
Source§

fn squeeze( &self, state: &<SerializingStatefulSponge<Inner> as StatefulHasher<F, [u32; OUT]>>::State, ) -> [u32; OUT]

Squeeze an output from the current state.
Source§

fn hash_rows<'a>(&self, rows: impl IntoIterator<Item = &'a [Item]>) -> Out
where Item: Copy + 'a, Self::State: Default,

One-shot hash of multiple row slices. Read more
Source§

impl<F, Inner, const OUT: usize> StatefulHasher<F, [u64; OUT]> for SerializingStatefulSponge<Inner>
where F: Field, Inner: StatefulHasher<u64, [u64; OUT]>,

Source§

type State = <Inner as StatefulHasher<u64, [u64; OUT]>>::State

The internal state type that evolves during absorption.
Source§

fn absorb_into( &self, state: &mut <SerializingStatefulSponge<Inner> as StatefulHasher<F, [u64; OUT]>>::State, input: impl IntoIterator<Item = F>, )

Absorb elements into the state with overwrite-mode and zero-padding semantics if applicable.
Source§

fn squeeze( &self, state: &<SerializingStatefulSponge<Inner> as StatefulHasher<F, [u64; OUT]>>::State, ) -> [u64; OUT]

Squeeze an output from the current state.
Source§

fn hash_rows<'a>(&self, rows: impl IntoIterator<Item = &'a [Item]>) -> Out
where Item: Copy + 'a, Self::State: Default,

One-shot hash of multiple row slices. Read more
Source§

impl<F, Inner, const OUT: usize> StatefulHasher<F, [u8; OUT]> for SerializingStatefulSponge<Inner>
where F: Field, Inner: StatefulHasher<u8, [u8; OUT]>,

Source§

type State = <Inner as StatefulHasher<u8, [u8; OUT]>>::State

The internal state type that evolves during absorption.
Source§

fn absorb_into( &self, state: &mut <SerializingStatefulSponge<Inner> as StatefulHasher<F, [u8; OUT]>>::State, input: impl IntoIterator<Item = F>, )

Absorb elements into the state with overwrite-mode and zero-padding semantics if applicable.
Source§

fn squeeze( &self, state: &<SerializingStatefulSponge<Inner> as StatefulHasher<F, [u8; OUT]>>::State, ) -> [u8; OUT]

Squeeze an output from the current state.
Source§

fn hash_rows<'a>(&self, rows: impl IntoIterator<Item = &'a [Item]>) -> Out
where Item: Copy + 'a, Self::State: Default,

One-shot hash of multiple row slices. Read more
Source§

impl<Inner> Copy for SerializingStatefulSponge<Inner>
where Inner: Copy,

Auto Trait Implementations§

§

impl<Inner> Freeze for SerializingStatefulSponge<Inner>
where Inner: Freeze,

§

impl<Inner> RefUnwindSafe for SerializingStatefulSponge<Inner>
where Inner: RefUnwindSafe,

§

impl<Inner> Send for SerializingStatefulSponge<Inner>
where Inner: Send,

§

impl<Inner> Sync for SerializingStatefulSponge<Inner>
where Inner: Sync,

§

impl<Inner> Unpin for SerializingStatefulSponge<Inner>
where Inner: Unpin,

§

impl<Inner> UnsafeUnpin for SerializingStatefulSponge<Inner>
where Inner: UnsafeUnpin,

§

impl<Inner> UnwindSafe for SerializingStatefulSponge<Inner>
where Inner: UnwindSafe,

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> Dup for T
where T: Copy + Clone,

Source§

fn dup(&self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more