pub trait MerkleHasher:
'static
+ Clone
+ Send
+ Sync {
type F: Field;
type Digest: 'static + Copy + Send + Sync;
// Required methods
fn hash_slice(&self, vals: &[Self::F]) -> Self::Digest;
fn compress(&self, left: Self::Digest, right: Self::Digest) -> Self::Digest;
// Provided method
fn tree_compress(&self, hashes: Vec<Self::Digest>) -> Self::Digest { ... }
}Expand description
Trait abstracting Merkle tree hash operations. This trait is used as part of the definition of
the StarkProtocolConfig.
The MerkleHasher is parameterized over the base field F used as leaves,
and provides a Digest type for internal nodes.
Required Associated Types§
Required Methods§
Sourcefn hash_slice(&self, vals: &[Self::F]) -> Self::Digest
fn hash_slice(&self, vals: &[Self::F]) -> Self::Digest
Hash a slice of field elements into a digest (used for leaf hashing).
Provided Methods§
Sourcefn tree_compress(&self, hashes: Vec<Self::Digest>) -> Self::Digest
fn tree_compress(&self, hashes: Vec<Self::Digest>) -> Self::Digest
Compress a vector of digests (must be power-of-two length) into a single digest by repeated binary compression.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".