binius_hash/vision/
compression.rs

1// Copyright 2025 Irreducible Inc.
2
3use digest::{Digest, Output};
4
5use super::digest::VisionHasherDigest;
6use crate::PseudoCompressionFunction;
7
8/// One-way compression function that compresses two 32-byte strings into a single 32-byte string.
9#[derive(Debug, Default, Clone)]
10pub struct Vision32Compression;
11
12impl PseudoCompressionFunction<Output<VisionHasherDigest>, 2> for Vision32Compression {
13	fn compress(&self, input: [Output<VisionHasherDigest>; 2]) -> Output<VisionHasherDigest> {
14		VisionHasherDigest::new()
15			.chain_update(input[0].as_slice())
16			.chain_update(input[1].as_slice())
17			.finalize()
18	}
19}