pub trait Poseidon2Params<F: PrimeField, const T: usize>: Clone {
const D: usize;
const EXT_ROUNDS: usize;
const INT_ROUNDS: usize;
const T: usize = T;
// Required methods
fn external_rc() -> &'static [[F; T]];
fn internal_rc() -> &'static [F];
fn internal_mat_diag_m_1() -> &'static [F; T];
// Provided method
fn sanity_check() -> bool { ... }
}
Expand description
Parameters required for a Poseidon2 permutation instance.
§Generic parameters
F
: field choiceT
: state size = rate + capacity,T
is made generic for easy trait bound onpermute<F,T>(input: [F; N])
and type safety onexternal_rc()
return type.
Required Associated Constants§
Sourceconst EXT_ROUNDS: usize
const EXT_ROUNDS: usize
round_F: number of external rounds (incl. initial and terminal) round_F = 2 * round_f
Sourceconst INT_ROUNDS: usize
const INT_ROUNDS: usize
round_P: number of internal rounds
Provided Associated Constants§
Required Methods§
Sourcefn external_rc() -> &'static [[F; T]]
fn external_rc() -> &'static [[F; T]]
round constants for all external rounds
Sourcefn internal_rc() -> &'static [F]
fn internal_rc() -> &'static [F]
round constants for internal rounds
Sourcefn internal_mat_diag_m_1() -> &'static [F; T]
fn internal_mat_diag_m_1() -> &'static [F; T]
diffusion (diagonal) matrix minus one used in internal rounds
Provided Methods§
Sourcefn sanity_check() -> bool
fn sanity_check() -> bool
A default sanity check on the parameters and constant getters
State size only supports: 2, 3, 4, 8, 12, 16, 20, 24 for now S-box size only supports: 3, 5, 7, 11
§Round constants
Rust doesn’t permit generic param to be used in const operations, thus
leveraging type system to ensure sanity such as const INT_RC: &'static [F; Self::INT_ROUNDS]
is not allowed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.