Trait snarkvm_curves::traits::pairing_engine::PairingEngine
source · pub trait PairingEngine: Sized + 'static + Copy + Debug + PartialEq + Eq + Hash + Sync + Send {
type Fr: PrimeField + SquareRootField + Into<<Self::Fr as PrimeField>::BigInteger>;
type G1Projective: ProjectiveCurve<BaseField = Self::Fq, ScalarField = Self::Fr, Affine = Self::G1Affine> + From<Self::G1Affine>;
type G1Affine: AffineCurve<BaseField = Self::Fq, ScalarField = Self::Fr, Projective = Self::G1Projective> + PairingCurve<PairWith = Self::G2Affine, PairingResult = Self::Fqk> + From<Self::G1Projective> + ToConstraintField<Self::Fq>;
type G2Projective: ProjectiveCurve<BaseField = Self::Fqe, ScalarField = Self::Fr, Affine = Self::G2Affine> + From<Self::G2Affine>;
type G2Affine: AffineCurve<BaseField = Self::Fqe, ScalarField = Self::Fr, Projective = Self::G2Projective> + PairingCurve<PairWith = Self::G1Affine, PairingResult = Self::Fqk> + From<Self::G2Projective> + ToConstraintField<Self::Fq>;
type Fq: PrimeField + SquareRootField;
type Fqe: SquareRootField;
type Fqk: Field;
fn miller_loop<'a, I>(i: I) -> Self::Fqk
where
I: Iterator<Item = (&'a <Self::G1Affine as PairingCurve>::Prepared, &'a <Self::G2Affine as PairingCurve>::Prepared)>;
fn final_exponentiation(_: &Self::Fqk) -> Option<Self::Fqk>;
fn product_of_pairings<'a, I>(i: I) -> Self::Fqk
where
I: Iterator<Item = (&'a <Self::G1Affine as PairingCurve>::Prepared, &'a <Self::G2Affine as PairingCurve>::Prepared)>,
{ ... }
fn pairing<G1, G2>(p: G1, q: G2) -> Self::Fqk
where
G1: Into<Self::G1Affine>,
G2: Into<Self::G2Affine>,
{ ... }
}
Required Associated Types§
sourcetype Fr: PrimeField + SquareRootField + Into<<Self::Fr as PrimeField>::BigInteger>
type Fr: PrimeField + SquareRootField + Into<<Self::Fr as PrimeField>::BigInteger>
This is the scalar field of the G1/G2 groups.
sourcetype G1Projective: ProjectiveCurve<BaseField = Self::Fq, ScalarField = Self::Fr, Affine = Self::G1Affine> + From<Self::G1Affine>
type G1Projective: ProjectiveCurve<BaseField = Self::Fq, ScalarField = Self::Fr, Affine = Self::G1Affine> + From<Self::G1Affine>
The projective representation of an element in G1.
sourcetype G1Affine: AffineCurve<BaseField = Self::Fq, ScalarField = Self::Fr, Projective = Self::G1Projective> + PairingCurve<PairWith = Self::G2Affine, PairingResult = Self::Fqk> + From<Self::G1Projective> + ToConstraintField<Self::Fq>
type G1Affine: AffineCurve<BaseField = Self::Fq, ScalarField = Self::Fr, Projective = Self::G1Projective> + PairingCurve<PairWith = Self::G2Affine, PairingResult = Self::Fqk> + From<Self::G1Projective> + ToConstraintField<Self::Fq>
The affine representation of an element in G1.
sourcetype G2Projective: ProjectiveCurve<BaseField = Self::Fqe, ScalarField = Self::Fr, Affine = Self::G2Affine> + From<Self::G2Affine>
type G2Projective: ProjectiveCurve<BaseField = Self::Fqe, ScalarField = Self::Fr, Affine = Self::G2Affine> + From<Self::G2Affine>
The projective representation of an element in G2.
sourcetype G2Affine: AffineCurve<BaseField = Self::Fqe, ScalarField = Self::Fr, Projective = Self::G2Projective> + PairingCurve<PairWith = Self::G1Affine, PairingResult = Self::Fqk> + From<Self::G2Projective> + ToConstraintField<Self::Fq>
type G2Affine: AffineCurve<BaseField = Self::Fqe, ScalarField = Self::Fr, Projective = Self::G2Projective> + PairingCurve<PairWith = Self::G1Affine, PairingResult = Self::Fqk> + From<Self::G2Projective> + ToConstraintField<Self::Fq>
The affine representation of an element in G2.
sourcetype Fq: PrimeField + SquareRootField
type Fq: PrimeField + SquareRootField
The base field that hosts G1.
sourcetype Fqe: SquareRootField
type Fqe: SquareRootField
The extension field that hosts G2.
Required Methods§
sourcefn miller_loop<'a, I>(i: I) -> Self::Fqkwhere
I: Iterator<Item = (&'a <Self::G1Affine as PairingCurve>::Prepared, &'a <Self::G2Affine as PairingCurve>::Prepared)>,
fn miller_loop<'a, I>(i: I) -> Self::Fqkwhere
I: Iterator<Item = (&'a <Self::G1Affine as PairingCurve>::Prepared, &'a <Self::G2Affine as PairingCurve>::Prepared)>,
Perform a miller loop with some number of (G1, G2) pairs.
sourcefn final_exponentiation(_: &Self::Fqk) -> Option<Self::Fqk>
fn final_exponentiation(_: &Self::Fqk) -> Option<Self::Fqk>
Perform final exponentiation of the result of a miller loop.
Provided Methods§
sourcefn product_of_pairings<'a, I>(i: I) -> Self::Fqkwhere
I: Iterator<Item = (&'a <Self::G1Affine as PairingCurve>::Prepared, &'a <Self::G2Affine as PairingCurve>::Prepared)>,
fn product_of_pairings<'a, I>(i: I) -> Self::Fqkwhere
I: Iterator<Item = (&'a <Self::G1Affine as PairingCurve>::Prepared, &'a <Self::G2Affine as PairingCurve>::Prepared)>,
Computes a product of pairings.