diff --git a/src/vector_commitment/vector_commitment.cairo b/src/vector_commitment/vector_commitment.cairo index 08b0a3b31..774dcd75c 100644 --- a/src/vector_commitment/vector_commitment.cairo +++ b/src/vector_commitment/vector_commitment.cairo @@ -3,6 +3,17 @@ use cairo_verifier::common::{ array_append::ArrayAppendTrait, blake2s::blake2s, }; +use poseidon::hades_permutation; + + +fn hash_blake_or_poseidon(x: felt252, y: felt252, is_verifier_friendly: bool) -> felt252 { + if is_verifier_friendly { + let (hash, _, _) = hades_permutation(x, y, 2); + hash + } else { + truncated_blake2s(x, y) + } +} fn truncated_blake2s(x: felt252, y: felt252) -> felt252 { let mut data = ArrayTrait::::new();