From 21989b89fe8c066f86f331b66f0ac4f6e3d5424b Mon Sep 17 00:00:00 2001 From: M Alghazwi Date: Tue, 8 Jul 2025 18:55:47 +0200 Subject: [PATCH] add generic Hasher --- proof-input/src/input_generator/utils.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/proof-input/src/input_generator/utils.rs b/proof-input/src/input_generator/utils.rs index 0bafc29..cdfe552 100755 --- a/proof-input/src/input_generator/utils.rs +++ b/proof-input/src/input_generator/utils.rs @@ -1,7 +1,7 @@ use plonky2::hash::hash_types::{HashOut, RichField}; +use plonky2::plonk::config::Hasher; use plonky2_field::extension::Extendable; use plonky2_poseidon2::poseidon2_hash::poseidon2::Poseidon2; -use crate::params::HF; use crate::hash::sponge::hash_n_with_padding; // --------- helper functions --------- @@ -42,7 +42,8 @@ pub fn low_bits(index: usize, bit_length: usize) -> Vec { /// this is the non-circuit version for testing pub fn calculate_cell_index_bits< F: RichField + Extendable + Poseidon2, - const D: usize + const D: usize, + H: Hasher, >(entropy: &Vec, slot_root: HashOut, ctr: usize, depth: usize, mask_bits: Vec) -> Vec { let ctr_field = F::from_canonical_u64(ctr as u64); let mut ctr_as_digest = HashOut::::ZERO; @@ -51,7 +52,7 @@ pub fn calculate_cell_index_bits< hash_inputs.extend_from_slice(&entropy); hash_inputs.extend_from_slice(&slot_root.elements); hash_inputs.extend_from_slice(&ctr_as_digest.elements); - let hash_output = hash_n_with_padding::(&hash_inputs); + let hash_output = hash_n_with_padding::(&hash_inputs); let cell_index_bytes = hash_output.elements[0].to_canonical_u64(); let cell_index_bits = low_bits(cell_index_bytes as usize, depth);