ark_test_curves

Trait QuadExtConfig

Source
pub trait QuadExtConfig:
    Sized
    + 'static
    + Send
    + Sync {
    type BasePrimeField: PrimeField;
    type BaseField: Field<BasePrimeField = Self::BasePrimeField>;
    type FrobCoeff: Field;

    const DEGREE_OVER_BASE_PRIME_FIELD: usize;
    const NONRESIDUE: Self::BaseField;
    const FROBENIUS_COEFF_C1: &'static [Self::FrobCoeff];

    // Required method
    fn mul_base_field_by_frob_coeff(fe: &mut Self::BaseField, power: usize);

    // Provided methods
    fn mul_base_field_by_nonresidue_in_place(
        fe: &mut Self::BaseField,
    ) -> &mut Self::BaseField { ... }
    fn mul_base_field_by_nonresidue_and_add(
        y: &mut Self::BaseField,
        x: &Self::BaseField,
    ) { ... }
    fn mul_base_field_by_nonresidue_plus_one_and_add(
        y: &mut Self::BaseField,
        x: &Self::BaseField,
    ) { ... }
    fn sub_and_mul_base_field_by_nonresidue(
        y: &mut Self::BaseField,
        x: &Self::BaseField,
    ) { ... }
}
Expand description

Defines a Quadratic extension field from a quadratic non-residue.

Required Associated Constants§

Source

const DEGREE_OVER_BASE_PRIME_FIELD: usize

The degree of the extension over the base prime field.

Source

const NONRESIDUE: Self::BaseField

The quadratic non-residue used to construct the extension.

Source

const FROBENIUS_COEFF_C1: &'static [Self::FrobCoeff]

Coefficients for the Frobenius automorphism.

Required Associated Types§

Source

type BasePrimeField: PrimeField

The prime field that this quadratic extension is eventually an extension of.

Source

type BaseField: Field<BasePrimeField = Self::BasePrimeField>

The base field that this field is a quadratic extension of.

Note: while for simple instances of quadratic extensions such as Fp2 we might see BaseField == BasePrimeField, it won’t always hold true. E.g. for an extension tower: BasePrimeField == Fp, but BaseField == Fp3.

Source

type FrobCoeff: Field

The type of the coefficients for an efficient implementation of the Frobenius endomorphism.

Required Methods§

Source

fn mul_base_field_by_frob_coeff(fe: &mut Self::BaseField, power: usize)

A specializable method for multiplying an element of the base field by the appropriate Frobenius coefficient.

Provided Methods§

Source

fn mul_base_field_by_nonresidue_in_place( fe: &mut Self::BaseField, ) -> &mut Self::BaseField

A specializable method for multiplying an element of the base field by the quadratic non-residue. This is used in Karatsuba multiplication and in complex squaring.

Source

fn mul_base_field_by_nonresidue_and_add( y: &mut Self::BaseField, x: &Self::BaseField, )

A specializable method for setting y = x + NONRESIDUE * y. This allows for optimizations when the non-residue is canonically negative in the field.

Source

fn mul_base_field_by_nonresidue_plus_one_and_add( y: &mut Self::BaseField, x: &Self::BaseField, )

A specializable method for computing x + mul_base_field_by_nonresidue(y) + y This allows for optimizations when the non-residue is not -1.

Source

fn sub_and_mul_base_field_by_nonresidue( y: &mut Self::BaseField, x: &Self::BaseField, )

A specializable method for computing x - mul_base_field_by_nonresidue(y) This allows for optimizations when the non-residue is canonically negative in the field.

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<P> QuadExtConfig for Fp6ConfigWrapper<P>
where P: Fp6Config,

Source§

impl<P> QuadExtConfig for Fp2ConfigWrapper<P>
where P: Fp2Config,

Source§

impl<P> QuadExtConfig for Fp4ConfigWrapper<P>
where P: Fp4Config,

Source§

impl<P> QuadExtConfig for Fp12ConfigWrapper<P>
where P: Fp12Config,