pub trait Fp2Config: 'static + Send + Sync + Sized {
type Fp: PrimeField;
const NONRESIDUE: Self::Fp;
const FROBENIUS_COEFF_FP2_C1: &'static [Self::Fp];
// Provided methods
fn mul_fp_by_nonresidue_in_place(fe: &mut Self::Fp) -> &mut Self::Fp { ... }
fn mul_fp_by_nonresidue_and_add(y: &mut Self::Fp, x: &Self::Fp) { ... }
fn mul_fp_by_nonresidue_plus_one_and_add(y: &mut Self::Fp, x: &Self::Fp) { ... }
fn sub_and_mul_fp_by_nonresidue(y: &mut Self::Fp, x: &Self::Fp) { ... }
}
Expand description
Trait that specifies constants and methods for defining degree-two extension fields.
Required Associated Types§
sourcetype Fp: PrimeField
type Fp: PrimeField
Base prime field underlying this extension.
Required Associated Constants§
sourceconst NONRESIDUE: Self::Fp
const NONRESIDUE: Self::Fp
Quadratic non-residue in Self::Fp
used to construct the extension
field. That is, NONRESIDUE
is such that the quadratic polynomial
f(X) = X^2 - Self::NONRESIDUE
in Fp[X] is irreducible in Self::Fp
.
sourceconst FROBENIUS_COEFF_FP2_C1: &'static [Self::Fp]
const FROBENIUS_COEFF_FP2_C1: &'static [Self::Fp]
Coefficients for the Frobenius automorphism.
Provided Methods§
sourcefn mul_fp_by_nonresidue_in_place(fe: &mut Self::Fp) -> &mut Self::Fp
fn mul_fp_by_nonresidue_in_place(fe: &mut Self::Fp) -> &mut Self::Fp
Return fe * Self::NONRESIDUE
.
Intended for specialization when Self::NONRESIDUE
has a special
structure that can speed up multiplication
sourcefn mul_fp_by_nonresidue_and_add(y: &mut Self::Fp, x: &Self::Fp)
fn mul_fp_by_nonresidue_and_add(y: &mut Self::Fp, x: &Self::Fp)
A specializable method for setting y = x + NONRESIDUE * y
.
This allows for optimizations when the non-residue is
canonically negative in the field.
sourcefn mul_fp_by_nonresidue_plus_one_and_add(y: &mut Self::Fp, x: &Self::Fp)
fn mul_fp_by_nonresidue_plus_one_and_add(y: &mut Self::Fp, x: &Self::Fp)
A specializable method for computing x + mul_fp_by_nonresidue(y) + y This allows for optimizations when the non-residue is not -1.
sourcefn sub_and_mul_fp_by_nonresidue(y: &mut Self::Fp, x: &Self::Fp)
fn sub_and_mul_fp_by_nonresidue(y: &mut Self::Fp, x: &Self::Fp)
A specializable method for computing x - mul_fp_by_nonresidue(y) This allows for optimizations when the non-residue is canonically negative in the field.