ark_ec::pairing

Trait 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

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: 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>