From e52b75b0d135cf4c1050fa4111eb7020c0c387e2 Mon Sep 17 00:00:00 2001 From: Daniel Lubarov Date: Sat, 25 Feb 2023 08:20:32 -0800 Subject: [PATCH] Fix `hash_or_noop` for general hash sizes --- plonky2/src/plonk/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plonky2/src/plonk/config.rs b/plonky2/src/plonk/config.rs index 36d29cff..cacc8421 100644 --- a/plonky2/src/plonk/config.rs +++ b/plonky2/src/plonk/config.rs @@ -53,7 +53,7 @@ pub trait Hasher: Sized + Clone + Debug + Eq + PartialEq { /// Hash the slice if necessary to reduce its length to ~256 bits. If it already fits, this is a /// no-op. fn hash_or_noop(inputs: &[F]) -> Self::Hash { - if inputs.len() <= 4 { + if inputs.len() * 8 <= Self::HASH_SIZE { let mut inputs_bytes = vec![0u8; Self::HASH_SIZE]; for i in 0..inputs.len() { inputs_bytes[i * 8..(i + 1) * 8]