Skip to main content

CompressionFunction

Trait CompressionFunction 

Source
pub trait CompressionFunction<T, const N: usize>: Clone {
    // Required method
    fn compress(&self, input: [T; N]) -> T;
}
Expand description

An N-to-1 compression function used to build the inner nodes of a hash tree.

It folds N values into a single value of the same type, so it can be applied level by level: the children of an inner node are compressed to produce that node.

Required Methods§

Source

fn compress(&self, input: [T; N]) -> T

Maps the N inputs down to a single output of the same type.

In a hash tree this folds the N child node values into their parent node value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl CompressionFunction<Array<u8, <Hasher as OutputSizeUser>::OutputSize>, 2> for Blake3Compression

Source§

impl CompressionFunction<Array<u8, <Sha256 as OutputSizeUser>::OutputSize>, 2> for Sha256Compression