mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-03-25 03:33:06 +00:00
12 lines
327 B
Rust
12 lines
327 B
Rust
|
|
use light_poseidon::{Poseidon, PoseidonBytesHasher, parameters::bn254_x5};
|
||
|
|
use ark_bn254::Fr;
|
||
|
|
use ark_ff::{BigInteger, PrimeField};
|
||
|
|
|
||
|
|
fn poseidon_hash(inputs: &[&[u8]]) -> anyhow::Result<[u8; 32]> {
|
||
|
|
let mut poseidon = Poseidon::<Fr>::new_circom(2).unwrap();
|
||
|
|
|
||
|
|
let hash = poseidon.hash_bytes_be(inputs)?;
|
||
|
|
|
||
|
|
Ok(hash)
|
||
|
|
}
|