Trait ark_ec::pairing::Pairing

source ·
pub trait Pairing: Sized + 'static + Copy + Debug + Sync + Send + Eq {
    type BaseField: PrimeField;
    type ScalarField: PrimeField;
    type G1: CurveGroup<ScalarField = Self::ScalarField, Affine = Self::G1Affine> + From<Self::G1Affine> + Into<Self::G1Affine> + MulAssign<Self::ScalarField>;
    type G1Affine: AffineRepr<Group = Self::G1, ScalarField = Self::ScalarField> + From<Self::G1> + Into<Self::G1> + Into<Self::G1Prepared>;
    type G1Prepared: Default + Clone + Send + Sync + Debug + CanonicalSerialize + CanonicalDeserialize + for<'a> From<&'a Self::G1> + for<'a> From<&'a Self::G1Affine> + From<Self::G1> + From<Self::G1Affine>;
    type G2: CurveGroup<ScalarField = Self::ScalarField, Affine = Self::G2Affine> + From<Self::G2Affine> + Into<Self::G2Affine> + MulAssign<Self::ScalarField>;
    type G2Affine: AffineRepr<Group = Self::G2, ScalarField = Self::ScalarField> + From<Self::G2> + Into<Self::G2> + Into<Self::G2Prepared>;
    type G2Prepared: Default + Clone + Send + Sync + Debug + CanonicalSerialize + CanonicalDeserialize + for<'a> From<&'a Self::G2> + for<'a> From<&'a Self::G2Affine> + From<Self::G2> + From<Self::G2Affine>;
    type TargetField: CyclotomicMultSubgroup;

    // Required methods
    fn multi_miller_loop(
        a: impl IntoIterator<Item = impl Into<Self::G1Prepared>>,
        b: impl IntoIterator<Item = impl Into<Self::G2Prepared>>
    ) -> MillerLoopOutput<Self>;
    fn final_exponentiation(
        mlo: MillerLoopOutput<Self>
    ) -> Option<PairingOutput<Self>>;

    // Provided methods
    fn miller_loop(
        a: impl Into<Self::G1Prepared>,
        b: impl Into<Self::G2Prepared>
    ) -> MillerLoopOutput<Self> { ... }
    fn multi_pairing(
        a: impl IntoIterator<Item = impl Into<Self::G1Prepared>>,
        b: impl IntoIterator<Item = impl Into<Self::G2Prepared>>
    ) -> PairingOutput<Self> { ... }
    fn pairing(
        p: impl Into<Self::G1Prepared>,
        q: impl Into<Self::G2Prepared>
    ) -> PairingOutput<Self> { ... }
}
Expand description

Collection of types (mainly fields and curves) that together describe how to compute a pairing over a pairing-friendly curve.

Required Associated Types§

source

type BaseField: PrimeField

This is the base field of the G1 group and base prime field of G2.

source

type ScalarField: PrimeField

This is the scalar field of the G1/G2 groups.

source

type G1: CurveGroup<ScalarField = Self::ScalarField, Affine = Self::G1Affine> + From<Self::G1Affine> + Into<Self::G1Affine> + MulAssign<Self::ScalarField>

An element in G1.

source

type G1Affine: AffineRepr<Group = Self::G1, ScalarField = Self::ScalarField> + From<Self::G1> + Into<Self::G1> + Into<Self::G1Prepared>

source

type G1Prepared: Default + Clone + Send + Sync + Debug + CanonicalSerialize + CanonicalDeserialize + for<'a> From<&'a Self::G1> + for<'a> From<&'a Self::G1Affine> + From<Self::G1> + From<Self::G1Affine>

A G1 element that has been preprocessed for use in a pairing.

source

type G2: CurveGroup<ScalarField = Self::ScalarField, Affine = Self::G2Affine> + From<Self::G2Affine> + Into<Self::G2Affine> + MulAssign<Self::ScalarField>

An element of G2.

source

type G2Affine: AffineRepr<Group = Self::G2, ScalarField = Self::ScalarField> + From<Self::G2> + Into<Self::G2> + Into<Self::G2Prepared>

The affine representation of an element in G2.

source

type G2Prepared: Default + Clone + Send + Sync + Debug + CanonicalSerialize + CanonicalDeserialize + for<'a> From<&'a Self::G2> + for<'a> From<&'a Self::G2Affine> + From<Self::G2> + From<Self::G2Affine>

A G2 element that has been preprocessed for use in a pairing.

source

type TargetField: CyclotomicMultSubgroup

The extension field that hosts the target group of the pairing.

Required Methods§

source

fn multi_miller_loop( a: impl IntoIterator<Item = impl Into<Self::G1Prepared>>, b: impl IntoIterator<Item = impl Into<Self::G2Prepared>> ) -> MillerLoopOutput<Self>

Computes the product of Miller loops for some number of (G1, G2) pairs.

source

fn final_exponentiation( mlo: MillerLoopOutput<Self> ) -> Option<PairingOutput<Self>>

Performs final exponentiation of the result of a Self::multi_miller_loop.

Provided Methods§

source

fn miller_loop( a: impl Into<Self::G1Prepared>, b: impl Into<Self::G2Prepared> ) -> MillerLoopOutput<Self>

Computes the Miller loop over a and b.

source

fn multi_pairing( a: impl IntoIterator<Item = impl Into<Self::G1Prepared>>, b: impl IntoIterator<Item = impl Into<Self::G2Prepared>> ) -> PairingOutput<Self>

Computes a “product” of pairings.

source

fn pairing( p: impl Into<Self::G1Prepared>, q: impl Into<Self::G2Prepared> ) -> PairingOutput<Self>

Performs multiple pairing operations

Implementors§

source§

impl<P: Bls12Config> Pairing for Bls12<P>

source§

impl<P: BnConfig> Pairing for Bn<P>

source§

impl<P: BW6Config> Pairing for BW6<P>

source§

impl<P: MNT4Config> Pairing for MNT4<P>

source§

impl<P: MNT6Config> Pairing for MNT6<P>