SerializingHasher

Struct SerializingHasher 

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

Converts a hasher which can hash bytes, u32’s or u64’s into a hasher which can hash field elements.

Supports two types of hashing.

  • Hashing a sequence of field elements.
  • Hashing a sequence of arrays of N field elements as if we are hashing N sequences of field elements in parallel. This is useful when the inner hash is able to use vectorized instructions to compute multiple hashes at once.

Implementations§

Source§

impl<Inner> SerializingHasher<Inner>

Source

pub const fn new(inner: Inner) -> Self

Trait Implementations§

Source§

impl<Inner: Clone> Clone for SerializingHasher<Inner>

Source§

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

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<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u32; M]; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<[u32; M], [[u32; M]; N]>,

Source§

fn hash_iter<I>(&self, input: I) -> [[u32; M]; N]
where I: IntoIterator<Item = [F; M]>,

Hash an iterator of input items. Read more
Source§

fn hash_iter_slices<'a, I>(&self, input: I) -> Out
where I: IntoIterator<Item = &'a [Item]>, Item: 'a,

Hash an iterator of slices, by flattening it into a single stream of items. Read more
Source§

fn hash_slice(&self, input: &[Item]) -> Out

Hash a single slice of items. Read more
Source§

fn hash_item(&self, input: Item) -> Out

Hash a single item. Read more
Source§

impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u64; M]; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<[u64; M], [[u64; M]; N]>,

Source§

fn hash_iter<I>(&self, input: I) -> [[u64; M]; N]
where I: IntoIterator<Item = [F; M]>,

Hash an iterator of input items. Read more
Source§

fn hash_iter_slices<'a, I>(&self, input: I) -> Out
where I: IntoIterator<Item = &'a [Item]>, Item: 'a,

Hash an iterator of slices, by flattening it into a single stream of items. Read more
Source§

fn hash_slice(&self, input: &[Item]) -> Out

Hash a single slice of items. Read more
Source§

fn hash_item(&self, input: Item) -> Out

Hash a single item. Read more
Source§

impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u8; M]; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<[u8; M], [[u8; M]; N]>,

Source§

fn hash_iter<I>(&self, input: I) -> [[u8; M]; N]
where I: IntoIterator<Item = [F; M]>,

Hash an iterator of input items. Read more
Source§

fn hash_iter_slices<'a, I>(&self, input: I) -> Out
where I: IntoIterator<Item = &'a [Item]>, Item: 'a,

Hash an iterator of slices, by flattening it into a single stream of items. Read more
Source§

fn hash_slice(&self, input: &[Item]) -> Out

Hash a single slice of items. Read more
Source§

fn hash_item(&self, input: Item) -> Out

Hash a single item. Read more
Source§

impl<F, Inner, const N: usize> CryptographicHasher<F, [u32; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<u32, [u32; N]>,

Source§

fn hash_iter<I>(&self, input: I) -> [u32; N]
where I: IntoIterator<Item = F>,

Hash an iterator of input items. Read more
Source§

fn hash_iter_slices<'a, I>(&self, input: I) -> Out
where I: IntoIterator<Item = &'a [Item]>, Item: 'a,

Hash an iterator of slices, by flattening it into a single stream of items. Read more
Source§

fn hash_slice(&self, input: &[Item]) -> Out

Hash a single slice of items. Read more
Source§

fn hash_item(&self, input: Item) -> Out

Hash a single item. Read more
Source§

impl<F, Inner, const N: usize> CryptographicHasher<F, [u64; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<u64, [u64; N]>,

Source§

fn hash_iter<I>(&self, input: I) -> [u64; N]
where I: IntoIterator<Item = F>,

Hash an iterator of input items. Read more
Source§

fn hash_iter_slices<'a, I>(&self, input: I) -> Out
where I: IntoIterator<Item = &'a [Item]>, Item: 'a,

Hash an iterator of slices, by flattening it into a single stream of items. Read more
Source§

fn hash_slice(&self, input: &[Item]) -> Out

Hash a single slice of items. Read more
Source§

fn hash_item(&self, input: Item) -> Out

Hash a single item. Read more
Source§

impl<F, Inner, const N: usize> CryptographicHasher<F, [u8; N]> for SerializingHasher<Inner>
where F: Field, Inner: CryptographicHasher<u8, [u8; N]>,

Source§

fn hash_iter<I>(&self, input: I) -> [u8; N]
where I: IntoIterator<Item = F>,

Hash an iterator of input items. Read more
Source§

fn hash_iter_slices<'a, I>(&self, input: I) -> Out
where I: IntoIterator<Item = &'a [Item]>, Item: 'a,

Hash an iterator of slices, by flattening it into a single stream of items. Read more
Source§

fn hash_slice(&self, input: &[Item]) -> Out

Hash a single slice of items. Read more
Source§

fn hash_item(&self, input: Item) -> Out

Hash a single item. Read more
Source§

impl<Inner: Debug> Debug for SerializingHasher<Inner>

Source§

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

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

impl<Inner: Copy> Copy for SerializingHasher<Inner>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<Inner> UnwindSafe for SerializingHasher<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> 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> 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<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