taceo_poseidon2/lib.rs
1#![deny(missing_docs, unsafe_code)]
2//! Poseidon2 permutation methods, based on [eprint.iacr.org/2023/323](https://eprint.iacr.org/2023/323).
3//!
4//! This crate provides efficient, pure-Rust, minimal APIs to compute the Poseidon2 permutation (not hash) on all supported state sizes (`t2`, `t3`, `t4`, `t8`, `t12`, `t16`).
5//!
6//! Currently, the only supported field is the scalar field of `bn254`.
7//!
8//! Parameters are compatible with the original Poseidon2 [parameter generation script](https://github.com/HorizenLabs/poseidon2/blob/main/poseidon2_rust_params.sage).
9//!
10//! # Examples
11//!
12//! ```ignore
13//! let mut state = [...];
14//! poseidon2::bn254::t4::permutation(&state);
15//! poseidon2::bn254::t4::permutation_in_place(&mut state);
16//! ```
17//!
18//! This crate is suitable for cryptographic circuits, SNARKs, and low-level integrations requiring only the permutation (not hashing).
19
20#[cfg(feature = "bn254")]
21pub mod bn254;
22mod perm;