lssa/sc_core/src/cryptography.rs

11 lines
270 B
Rust
Raw Normal View History

2025-03-16 11:05:08 -04:00
use ark_bn254::Fr;
2025-03-16 11:37:23 -04:00
use light_poseidon::{Poseidon, PoseidonBytesHasher};
2025-03-16 11:05:08 -04:00
pub fn poseidon_hash(inputs: &[&[u8]]) -> anyhow::Result<[u8; 32]> {
2025-03-16 11:05:08 -04:00
let mut poseidon = Poseidon::<Fr>::new_circom(2).unwrap();
let hash = poseidon.hash_bytes_be(inputs)?;
Ok(hash)
}