Skip to main content

ParallelHashSuite

Trait ParallelHashSuite 

Source
pub trait ParallelHashSuite: HashSuite {
    type ParLeafHash: ParallelDigest<Digest = Self::LeafHash> + Default;
    type ParCompression: ParallelPseudoCompression<Output<Self::LeafHash>, 2, Compression = Self::Compression> + Default + Sync;
}
Expand description

A hash suite with the batched hashes a prover needs on top of the sequential ones.

Verification walks one Merkle path, so the sequential pair is enough for it. Proving folds whole layers at once, where batching independent messages per call is what keeps the hash off the critical path.

Each batched hash is required to agree with its sequential counterpart byte for byte, so the two sides of a proof commit to the same tree.

Required Associated Types§

Source

type ParLeafHash: ParallelDigest<Digest = Self::LeafHash> + Default

Batched counterpart of the sequential leaf hash.

Source

type ParCompression: ParallelPseudoCompression<Output<Self::LeafHash>, 2, Compression = Self::Compression> + Default + Sync

Batched counterpart of the sequential inner-node compression.

Sync because one instance is shared across threads while folding the tree.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ParallelHashSuite for Blake3HashSuite

Batched Blake3, on top of the sequential pair the verifier side defines.

The batch width is 16 lanes for both paths:

  • the throughput sweet spot on NEON in the portable-kernel benchmark.
  • the width the AVX2 and AVX-512 vectorizers fill.
  • 4 and 8 lanes both measure slower.
Source§

impl ParallelHashSuite for Sha256HashSuite

Batched SHA-256, on top of the sequential pair the verifier side defines.

Implementors§