poseidon_paramgen/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]
2#![allow(non_snake_case)]
3#![deny(missing_docs)]
4//! Module for generating parameters for the Poseidon SNARK-friendly hash function.
5//!
6//! This crate will, given a choice of:
7//!
8//! * M, the desired security level (in bits),
9//! * t, the width of the desired hash function, e.g. $t=3$ corresponds to 2-to-1 hash.
10//! * p, the prime modulus,
11//! * `allow_inverse`, whether or not to allow an inverse alpha for the Sbox layer.
12//!
13//! generate the best choice of parameters, for both the unoptimized version of Poseidon
14//! specified in the [Poseidon paper], as well as the optimizations described in Appendix
15//! B.
16//!
17//! [Poseidon paper]: https://eprint.iacr.org/2019/458.pdf
18
19#[cfg(not(feature = "std"))]
20extern crate alloc;
21
22/// Logic for generating Poseidon1 parameters.
23pub mod v1;
24
25/// Logic for generating Poseidon2 parameters.
26pub mod v2;
27
28mod alpha;
29mod appendix_g;
30mod input;
31mod mds;
32mod round_constants;
33mod rounds;
34mod transcript;
35mod utils;
36
37/// For generating parameters at build time.
38#[cfg(feature = "std")]
39mod poseidon_build;
40
41use utils::log2;