pub trait PseudoCompressionFunction<T, const N: usize>: Clone {
const LANES: usize = 1;
// Required method
fn compress(&self, input: [T; N]) -> T;
// Provided method
fn compress_many(&self, inputs: &[[T; N]], out: &mut [T])
where T: Clone { ... }
}Expand description
An N-to-1 compression function collision-resistant in a hash tree setting.
Unlike CompressionFunction, it may not be collision-resistant in general.
Instead it is only collision-resistant in hash-tree like settings where
the preimage of a non-leaf node must consist of compression outputs.
Provided Associated Constants§
Sourceconst LANES: usize = 1
const LANES: usize = 1
Number of independent compressions this implementation performs most efficiently in one call.
One means every group is compressed on its own, which is the behaviour of a plain scalar permutation. A vectorized implementation reports how many independent states its permutation advances at once.
Callers read this only to decide whether grouping compressions is worth the bookkeeping.
Required Methods§
Provided Methods§
Sourcefn compress_many(&self, inputs: &[[T; N]], out: &mut [T])where
T: Clone,
fn compress_many(&self, inputs: &[[T; N]], out: &mut [T])where
T: Clone,
Compress a batch of input groups, one output per group.
inputs: [ grp_0 | grp_1 | ... | grp_{m-1} ] m groups of N inputs
out: [ dig_0 | dig_1 | ... | dig_{m-1} ] m outputsThe default compresses the groups one at a time. An override exists purely to exploit vector hardware and must return the very same outputs.
§Panics
Panics if the batch is ragged: the group count must equal the output count.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".