pub trait Anemoi<'a, F: Field> {
Show 14 associated constants and 9 methods
const NUM_COLUMNS: usize;
const NUM_ROUNDS: usize;
const WIDTH: usize;
const RATE: usize;
const OUTPUT_SIZE: usize;
const ARK_C: &'a [F];
const ARK_D: &'a [F];
const GROUP_GENERATOR: u32;
const ALPHA: u32;
const INV_ALPHA: F;
const BETA: u32;
const DELTA: F;
const MDS: Option<&'a [F]> = None;
const QUAD: u32 = 2u32;
// Required method
fn exp_by_inv_alpha(x: F) -> F;
// Provided methods
fn mul_by_generator(x: &F) -> F { ... }
fn exp_by_alpha(x: F) -> F { ... }
fn ark_layer(state: &mut [F], round_ctr: usize) { ... }
fn mds_layer(state: &mut [F]) { ... }
fn mds_internal(state: &mut [F]) { ... }
fn sbox_layer(state: &mut [F]) { ... }
fn round(state: &mut [F], round_ctr: usize) { ... }
fn permutation(state: &mut [F]) { ... }
}
Expand description
An Anemoi instance, defining the Anemoi permutation over a given finite field for a given instance size.
Required Associated Constants§
Sourceconst NUM_COLUMNS: usize
const NUM_COLUMNS: usize
Number of columns of this Anemoi instance.
Sourceconst NUM_ROUNDS: usize
const NUM_ROUNDS: usize
Number of rounds of this Anemoi instance.
Sourceconst WIDTH: usize
const WIDTH: usize
Width of this Anemoi instance. Should always be equal to twice the number of columns.
Sourceconst OUTPUT_SIZE: usize
const OUTPUT_SIZE: usize
The output size of this Anemoi instance, in both Sponge or Jive mode.
Sourceconst ARK_C: &'a [F]
const ARK_C: &'a [F]
The first set of additive round constants (C) used for this Anemoi instance.
Sourceconst ARK_D: &'a [F]
const ARK_D: &'a [F]
The first set of additive round constants (D) used for this Anemoi instance.
Sourceconst GROUP_GENERATOR: u32
const GROUP_GENERATOR: u32
The group generator of the underlying field of this Anemoi instance. It is defined to possibly speed up the MDS layer for small instances.
Provided Associated Constants§
Required Methods§
Sourcefn exp_by_inv_alpha(x: F) -> F
fn exp_by_inv_alpha(x: F) -> F
Helper method to exponentiate by this Anemoi instance’s INV_ALPHA
parameter.
It is left to implementors to provide efficient multiplication chains.
Provided Methods§
Sourcefn mul_by_generator(x: &F) -> F
fn mul_by_generator(x: &F) -> F
Helper method to possibly speed-up the linear layer.
It is also used by the S-Box layer as Self::BETA
is defined as the generator.
Sourcefn exp_by_alpha(x: F) -> F
fn exp_by_alpha(x: F) -> F
Helper method to exponentiate by this Anemoi instance’s ALPHA
parameter.
Sourcefn mds_internal(state: &mut [F])
fn mds_internal(state: &mut [F])
Utility method for the mds_layer.
Sourcefn sbox_layer(state: &mut [F])
fn sbox_layer(state: &mut [F])
The S-Box layer.
Sourcefn round(state: &mut [F], round_ctr: usize)
fn round(state: &mut [F], round_ctr: usize)
A full round of a permutation for this Anemoi instance.
Sourcefn permutation(state: &mut [F])
fn permutation(state: &mut [F])
An entire permutation for this Anemoi instance.
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.