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
Nfield elements as if we are hashingNsequences 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>
impl<Inner> SerializingHasher<Inner>
Trait Implementations§
Source§impl<Inner: Clone> Clone for SerializingHasher<Inner>
impl<Inner: Clone> Clone for SerializingHasher<Inner>
impl<Inner: Copy> Copy for SerializingHasher<Inner>
Source§impl<F, Inner, const N: usize> CryptographicHasher<F, [u8; N]> for SerializingHasher<Inner>
impl<F, Inner, const N: usize> CryptographicHasher<F, [u8; N]> for SerializingHasher<Inner>
Source§const LANES: usize
const LANES: usize
Forwarded from the inner byte hasher, the one digest shape here that batches.
The [u32; N] and [u64; N] shapes wrap word sponges that hash a single message per call.
The packed [[uX; M]; N] shapes already drive a vector permutation, one lane per packed slot.
Both keep the trait default of one lane, which routes a Merkle tree through its packed arm.
Source§fn hash_iter<I>(&self, input: I) -> [u8; N]where
I: IntoIterator<Item = F>,
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_many(&self, input: &[F], out: &mut [[u8; N]])
fn hash_many(&self, input: &[F], out: &mut [[u8; N]])
Hash a batch of equal-length messages, one digest per message. Read more
Source§const PREFER_CONTIGUOUS_INPUT: bool = false
const PREFER_CONTIGUOUS_INPUT: bool = false
Whether materializing a compound input iterator can improve hashing throughput. Read more
Source§fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
I: IntoIterator<Item = &'a [Item]>,
Item: 'a,
fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
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
fn hash_slice(&self, input: &[Item]) -> Out
Hash a single slice of items. Read more
Source§impl<F, Inner, const N: usize> CryptographicHasher<F, [u32; N]> for SerializingHasher<Inner>
impl<F, Inner, const N: usize> CryptographicHasher<F, [u32; N]> for SerializingHasher<Inner>
Source§fn hash_iter<I>(&self, input: I) -> [u32; N]where
I: IntoIterator<Item = F>,
fn hash_iter<I>(&self, input: I) -> [u32; N]where
I: IntoIterator<Item = F>,
Hash an iterator of input items. Read more
Source§const LANES: usize = 1
const LANES: usize = 1
Number of equal-length messages this implementation hashes most efficiently in one call. Read more
Source§const PREFER_CONTIGUOUS_INPUT: bool = false
const PREFER_CONTIGUOUS_INPUT: bool = false
Whether materializing a compound input iterator can improve hashing throughput. Read more
Source§fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
I: IntoIterator<Item = &'a [Item]>,
Item: 'a,
fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
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
fn hash_slice(&self, input: &[Item]) -> Out
Hash a single slice of items. Read more
Source§impl<F, Inner, const N: usize> CryptographicHasher<F, [u64; N]> for SerializingHasher<Inner>
impl<F, Inner, const N: usize> CryptographicHasher<F, [u64; N]> for SerializingHasher<Inner>
Source§fn hash_iter<I>(&self, input: I) -> [u64; N]where
I: IntoIterator<Item = F>,
fn hash_iter<I>(&self, input: I) -> [u64; N]where
I: IntoIterator<Item = F>,
Hash an iterator of input items. Read more
Source§const LANES: usize = 1
const LANES: usize = 1
Number of equal-length messages this implementation hashes most efficiently in one call. Read more
Source§const PREFER_CONTIGUOUS_INPUT: bool = false
const PREFER_CONTIGUOUS_INPUT: bool = false
Whether materializing a compound input iterator can improve hashing throughput. Read more
Source§fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
I: IntoIterator<Item = &'a [Item]>,
Item: 'a,
fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
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
fn hash_slice(&self, input: &[Item]) -> Out
Hash a single slice of items. Read more
Source§impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u8; M]; N]> for SerializingHasher<Inner>
impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u8; M]; N]> for SerializingHasher<Inner>
Source§fn hash_iter<I>(&self, input: I) -> [[u8; M]; N]where
I: IntoIterator<Item = [F; M]>,
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§const LANES: usize = 1
const LANES: usize = 1
Number of equal-length messages this implementation hashes most efficiently in one call. Read more
Source§const PREFER_CONTIGUOUS_INPUT: bool = false
const PREFER_CONTIGUOUS_INPUT: bool = false
Whether materializing a compound input iterator can improve hashing throughput. Read more
Source§fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
I: IntoIterator<Item = &'a [Item]>,
Item: 'a,
fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
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
fn hash_slice(&self, input: &[Item]) -> Out
Hash a single slice of items. Read more
Source§impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u32; M]; N]> for SerializingHasher<Inner>
impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u32; M]; N]> for SerializingHasher<Inner>
Source§fn hash_iter<I>(&self, input: I) -> [[u32; M]; N]where
I: IntoIterator<Item = [F; M]>,
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§const LANES: usize = 1
const LANES: usize = 1
Number of equal-length messages this implementation hashes most efficiently in one call. Read more
Source§const PREFER_CONTIGUOUS_INPUT: bool = false
const PREFER_CONTIGUOUS_INPUT: bool = false
Whether materializing a compound input iterator can improve hashing throughput. Read more
Source§fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
I: IntoIterator<Item = &'a [Item]>,
Item: 'a,
fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
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
fn hash_slice(&self, input: &[Item]) -> Out
Hash a single slice of items. Read more
Source§impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u64; M]; N]> for SerializingHasher<Inner>
impl<F, Inner, const N: usize, const M: usize> CryptographicHasher<[F; M], [[u64; M]; N]> for SerializingHasher<Inner>
Source§const PREFER_CONTIGUOUS_INPUT: bool
const PREFER_CONTIGUOUS_INPUT: bool
Whether materializing a compound input iterator can improve hashing throughput. Read more
Source§fn hash_iter<I>(&self, input: I) -> [[u64; M]; N]where
I: IntoIterator<Item = [F; M]>,
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§const LANES: usize = 1
const LANES: usize = 1
Number of equal-length messages this implementation hashes most efficiently in one call. Read more
Source§fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
I: IntoIterator<Item = &'a [Item]>,
Item: 'a,
fn hash_iter_slices<'a, I>(&self, input: I) -> Outwhere
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
fn hash_slice(&self, input: &[Item]) -> Out
Hash a single slice of items. Read more
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> UnsafeUnpin for SerializingHasher<Inner>where
Inner: UnsafeUnpin,
impl<Inner> UnwindSafe for SerializingHasher<Inner>where
Inner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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