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//! [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>::new(
21//!   fq_kimchi::static_params(),
22//! );
23//! let challenge = sponge.challenge();
24//! ```
25
26#![no_std]
27
28pub mod constants;
29pub mod dummy_values;
30pub mod pasta;
31pub mod permutation;
32pub mod poseidon;
33pub mod sponge;
34
35pub use sponge::FqSponge; // Commonly used so reexported for convenience