From 216436d027777d3c81baa70e478a6c017cd244bc Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Wed, 18 Sep 2024 11:01:09 +0800 Subject: [PATCH] chore: add `poseidon_permute_comp` back --- starknet-crypto/src/lib.rs | 4 +++- starknet-crypto/src/poseidon_hash.rs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/starknet-crypto/src/lib.rs b/starknet-crypto/src/lib.rs index 321f4e5f..ce10c1f3 100644 --- a/starknet-crypto/src/lib.rs +++ b/starknet-crypto/src/lib.rs @@ -35,7 +35,9 @@ pub use starknet_types_core::felt::Felt; pub use pedersen_hash::pedersen_hash; -pub use poseidon_hash::{poseidon_hash, poseidon_hash_many, poseidon_hash_single, PoseidonHasher}; +pub use poseidon_hash::{ + poseidon_hash, poseidon_hash_many, poseidon_hash_single, poseidon_permute_comp, PoseidonHasher, +}; pub use ecdsa::{get_public_key, recover, sign, verify, ExtendedSignature, Signature}; diff --git a/starknet-crypto/src/poseidon_hash.rs b/starknet-crypto/src/poseidon_hash.rs index 4155f056..ff557ded 100644 --- a/starknet-crypto/src/poseidon_hash.rs +++ b/starknet-crypto/src/poseidon_hash.rs @@ -97,6 +97,11 @@ pub fn poseidon_hash_many<'a, I: IntoIterator>(msgs: I) -> Felt state[0] } +/// Poseidon permutation function. +pub fn poseidon_permute_comp(state: &mut [Felt; 3]) { + Poseidon::hades_permutation(state) +} + #[cfg(test)] mod tests { use starknet_types_core::hash::StarkHash;