Skip to content

Commit

Permalink
Implement hash_blake_or_poseidon
Browse files Browse the repository at this point in the history
  • Loading branch information
fmkra committed Dec 29, 2023
1 parent 40cf4dc commit 1d54c3e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/vector_commitment/vector_commitment.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u32>::new();
Expand Down

0 comments on commit 1d54c3e

Please sign in to comment.