Skip to main content

binius_hash/
suite.rs

1// Copyright 2026 The Binius Developers
2
3//! The hash pair a Merkle commitment is built from.
4
5use digest::{Digest, FixedOutputReset, Output, block_api::BlockSizeUser};
6
7use crate::compress::CompressionFunction;
8
9/// The two hashes a Merkle commitment needs: one for leaves, one for inner nodes.
10///
11/// Verification walks a single path, so both are sequential.
12/// Proving folds whole layers at once and needs a batched counterpart for each, which the
13/// prover-side crate adds through its own extension of this trait.
14pub trait HashSuite {
15	/// Sequential hash used to compute leaf digests.
16	type LeafHash: Digest + BlockSizeUser + FixedOutputReset + Send;
17	/// Sequential 2-to-1 compression used to fold inner Merkle nodes.
18	type Compression: CompressionFunction<Output<Self::LeafHash>, 2> + Default;
19}