openzeppelin_crypto/poseidon2/params.rs
1//! This module contains a trait with poseidon hash parameters.
2//!
3//! Consumer of this trait should implement the parameters for the specific
4//! poseidon hash instance.
5//! Or use the existing instances in the [`crate::poseidon2::instance`] module.
6
7use crate::field::prime::PrimeField;
8
9/// Poseidon hash parameters.
10pub trait PoseidonParams<F: PrimeField> {
11 /// State size.
12 const T: usize;
13
14 /// Sbox degree.
15 const D: u8;
16
17 /// Capacity of the sponge construction.
18 /// Determines the number of elements not affected directly by input
19 /// or not reflected in the output of the sponge hash function.
20 const CAPACITY: usize;
21
22 /// Number of full rounds.
23 const ROUNDS_F: usize;
24
25 /// Number of partial rounds.
26 const ROUNDS_P: usize;
27
28 /// MDS (Maximum Distance Separable) matrix used in the Poseidon
29 /// permutation.
30 const MAT_INTERNAL_DIAG_M_1: &'static [F];
31
32 /// The round constants used in the full and partial rounds of the Poseidon
33 /// permutation.
34 const ROUND_CONSTANTS: &'static [&'static [F]];
35}