mina_poseidon/lib.rs
1//! This crate provides a generic implementation of the Poseidon hash function.
2//! It provides a [`Sponge`](crate::sponge::FqSponge) trait that can be
3//! implemented for any field.
4//!
5//! Some parameters for the Pasta fields are provided in the sub-crate
6//! [`pasta`](crate::pasta).
7//!
8//! To instantiate an object that can be used to generate challenges for the
9//! Fiat-Shamir transformation, use the
10//! [`DefaultFqSponge`](crate::sponge::DefaultFqSponge) struct. For instance, to
11//! instantiate with the parameters used by the Mina hard-fork called Berkeley,
12//! use:
13//! ```rust
14//! use mina_curves::pasta::{VestaParameters};
15//! use mina_poseidon::sponge::DefaultFqSponge;
16//! use mina_poseidon::FqSponge;
17//! use mina_poseidon::constants::PlonkSpongeConstantsKimchi;
18//! use mina_poseidon::pasta::fq_kimchi;
19//!
20//! let mut sponge = DefaultFqSponge::<VestaParameters, PlonkSpongeConstantsKimchi, { mina_poseidon::pasta::FULL_ROUNDS }>::new(
21//! fq_kimchi::static_params(),
22//! );
23//! let challenge = sponge.challenge();
24//! ```
25
26#![deny(unsafe_code)]
27#![deny(clippy::all)]
28#![deny(clippy::pedantic)]
29#![deny(clippy::nursery)]
30#![no_std]
31
32extern crate alloc;
33
34pub mod constants;
35pub mod dummy_values;
36pub mod pasta;
37pub mod permutation;
38pub mod poseidon;
39pub mod sponge;
40
41pub use sponge::FqSponge; // Commonly used so reexported for convenience