anemoi

Trait Anemoi

Source
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§

Source

const NUM_COLUMNS: usize

Number of columns of this Anemoi instance.

Source

const NUM_ROUNDS: usize

Number of rounds of this Anemoi instance.

Source

const WIDTH: usize

Width of this Anemoi instance. Should always be equal to twice the number of columns.

Source

const RATE: usize

The rate of this Anemoi instance when used in Sponge mode.

Source

const OUTPUT_SIZE: usize

The output size of this Anemoi instance, in both Sponge or Jive mode.

Source

const ARK_C: &'a [F]

The first set of additive round constants (C) used for this Anemoi instance.

Source

const ARK_D: &'a [F]

The first set of additive round constants (D) used for this Anemoi instance.

Source

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.

Source

const ALPHA: u32

The alpha exponent used for this Anemoi instance’s S-Box layer.

Source

const INV_ALPHA: F

The inv_alpha exponent used for this Anemoi instance’s S-Box layer.

Source

const BETA: u32

The beta constant used for this Anemoi instance’s S-Box layer.

Source

const DELTA: F

The delta constant used for this Anemoi instance’s S-Box layer.

Provided Associated Constants§

Source

const MDS: Option<&'a [F]> = None

The MDS matrix used for this Anemoi instance’s linear layer. It is optional as short instances benefit from a custom low-cost matrix-vector product for the Anemoi linear layer.

Source

const QUAD: u32 = 2u32

The quadratic factor used for this Anemoi instance’s S-Box layer. Binary fields are not supported here, hence it is always set to 2.

Required Methods§

Source

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§

Source

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.

Source

fn exp_by_alpha(x: F) -> F

Helper method to exponentiate by this Anemoi instance’s ALPHA parameter.

Source

fn ark_layer(state: &mut [F], round_ctr: usize)

Additive Round Constants (ARK) layer.

Source

fn mds_layer(state: &mut [F])

Linear layer.

Source

fn mds_internal(state: &mut [F])

Utility method for the mds_layer.

Source

fn sbox_layer(state: &mut [F])

The S-Box layer.

Source

fn round(state: &mut [F], round_ctr: usize)

A full round of a permutation for this Anemoi instance.

Source

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.

Implementors§

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FrConfig, 4>, 4>> for AnemoiEdOnBls12_377_2_1

Source§

const NUM_COLUMNS: usize = 1usize

Source§

const NUM_ROUNDS: usize = 19usize

Source§

const WIDTH: usize = 2usize

Source§

const RATE: usize = 1usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 22u32

Source§

const ALPHA: u32 = 11u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 22u32

Source§

const DELTA: Felt = sbox::DELTA

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FrConfig, 4>, 4>> for AnemoiEdOnBls12_377_4_3

Source§

const NUM_COLUMNS: usize = 2usize

Source§

const NUM_ROUNDS: usize = 13usize

Source§

const WIDTH: usize = 4usize

Source§

const RATE: usize = 3usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 22u32

Source§

const ALPHA: u32 = 11u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 22u32

Source§

const DELTA: Felt = sbox::DELTA

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FqConfig, 6>, 6>> for AnemoiBls12_381_2_1

Source§

const NUM_COLUMNS: usize = 1usize

Source§

const NUM_ROUNDS: usize = 21usize

Source§

const WIDTH: usize = 2usize

Source§

const RATE: usize = 1usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 2u32

Source§

const ALPHA: u32 = 5u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 2u32

Source§

const DELTA: Felt = sbox::DELTA

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FqConfig, 6>, 6>> for AnemoiBls12_381_4_3

Source§

const NUM_COLUMNS: usize = 2usize

Source§

const NUM_ROUNDS: usize = 14usize

Source§

const WIDTH: usize = 4usize

Source§

const RATE: usize = 3usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 2u32

Source§

const ALPHA: u32 = 5u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 2u32

Source§

const DELTA: Felt = sbox::DELTA

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FrConfig, 4>, 4>> for AnemoiJubjub_2_1

Source§

const NUM_COLUMNS: usize = 1usize

Source§

const NUM_ROUNDS: usize = 21usize

Source§

const WIDTH: usize = 2usize

Source§

const RATE: usize = 1usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 7u32

Source§

const ALPHA: u32 = 5u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 7u32

Source§

const DELTA: Felt = sbox::DELTA

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FrConfig, 4>, 4>> for AnemoiJubjub_4_3

Source§

const NUM_COLUMNS: usize = 2usize

Source§

const NUM_ROUNDS: usize = 14usize

Source§

const WIDTH: usize = 4usize

Source§

const RATE: usize = 3usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 7u32

Source§

const ALPHA: u32 = 5u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 7u32

Source§

const DELTA: Felt = sbox::DELTA

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FqConfig, 4>, 4>> for AnemoiPallas_2_1

Source§

const NUM_COLUMNS: usize = 1usize

Source§

const NUM_ROUNDS: usize = 21usize

Source§

const WIDTH: usize = 2usize

Source§

const RATE: usize = 1usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 5u32

Source§

const ALPHA: u32 = 5u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 5u32

Source§

const DELTA: Felt = sbox::DELTA

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FqConfig, 4>, 4>> for AnemoiPallas_4_3

Source§

const NUM_COLUMNS: usize = 2usize

Source§

const NUM_ROUNDS: usize = 14usize

Source§

const WIDTH: usize = 4usize

Source§

const RATE: usize = 3usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 5u32

Source§

const ALPHA: u32 = 5u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 5u32

Source§

const DELTA: Felt = sbox::DELTA

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FrConfig, 4>, 4>> for AnemoiVesta_2_1

Source§

const NUM_COLUMNS: usize = 1usize

Source§

const NUM_ROUNDS: usize = 21usize

Source§

const WIDTH: usize = 2usize

Source§

const RATE: usize = 1usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 5u32

Source§

const ALPHA: u32 = 5u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 5u32

Source§

const DELTA: Felt = sbox::DELTA

Source§

impl<'a> Anemoi<'a, Fp<MontBackend<FrConfig, 4>, 4>> for AnemoiVesta_4_3

Source§

const NUM_COLUMNS: usize = 2usize

Source§

const NUM_ROUNDS: usize = 14usize

Source§

const WIDTH: usize = 4usize

Source§

const RATE: usize = 3usize

Source§

const OUTPUT_SIZE: usize = 1usize

Source§

const ARK_C: &'a [Felt]

Source§

const ARK_D: &'a [Felt]

Source§

const GROUP_GENERATOR: u32 = 5u32

Source§

const ALPHA: u32 = 5u32

Source§

const INV_ALPHA: Felt = sbox::INV_ALPHA

Source§

const BETA: u32 = 5u32

Source§

const DELTA: Felt = sbox::DELTA