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§
Sourcetype BaseField: PrimeField
type BaseField: PrimeField
This is the base field of the G1 group and base prime field of G2.
Sourcetype ScalarField: PrimeField
type ScalarField: PrimeField
This is the scalar field of the G1/G2 groups.
Sourcetype G1: CurveGroup<ScalarField = Self::ScalarField, Affine = Self::G1Affine> + From<Self::G1Affine> + Into<Self::G1Affine> + MulAssign<Self::ScalarField>
type G1: CurveGroup<ScalarField = Self::ScalarField, Affine = Self::G1Affine> + From<Self::G1Affine> + Into<Self::G1Affine> + MulAssign<Self::ScalarField>
An element in G1.
type G1Affine: AffineRepr<Group = Self::G1, ScalarField = Self::ScalarField> + From<Self::G1> + Into<Self::G1> + Into<Self::G1Prepared>
Sourcetype 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 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.
Sourcetype G2: CurveGroup<ScalarField = Self::ScalarField, Affine = Self::G2Affine> + From<Self::G2Affine> + Into<Self::G2Affine> + MulAssign<Self::ScalarField>
type G2: CurveGroup<ScalarField = Self::ScalarField, Affine = Self::G2Affine> + From<Self::G2Affine> + Into<Self::G2Affine> + MulAssign<Self::ScalarField>
An element of G2.
Sourcetype G2Affine: AffineRepr<Group = Self::G2, ScalarField = Self::ScalarField> + From<Self::G2> + Into<Self::G2> + Into<Self::G2Prepared>
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.
Sourcetype 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 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.
Sourcetype TargetField: CyclotomicMultSubgroup
type TargetField: CyclotomicMultSubgroup
The extension field that hosts the target group of the pairing.
Required Methods§
Sourcefn multi_miller_loop(
a: impl IntoIterator<Item = impl Into<Self::G1Prepared>>,
b: impl IntoIterator<Item = impl Into<Self::G2Prepared>>,
) -> MillerLoopOutput<Self>
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.
Sourcefn final_exponentiation(
mlo: MillerLoopOutput<Self>,
) -> Option<PairingOutput<Self>>
fn final_exponentiation( mlo: MillerLoopOutput<Self>, ) -> Option<PairingOutput<Self>>
Performs final exponentiation of the result of a Self::multi_miller_loop
.
Provided Methods§
Sourcefn miller_loop(
a: impl Into<Self::G1Prepared>,
b: impl Into<Self::G2Prepared>,
) -> MillerLoopOutput<Self>
fn miller_loop( a: impl Into<Self::G1Prepared>, b: impl Into<Self::G2Prepared>, ) -> MillerLoopOutput<Self>
Computes the Miller loop over a
and b
.
Sourcefn multi_pairing(
a: impl IntoIterator<Item = impl Into<Self::G1Prepared>>,
b: impl IntoIterator<Item = impl Into<Self::G2Prepared>>,
) -> PairingOutput<Self>
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.
Sourcefn pairing(
p: impl Into<Self::G1Prepared>,
q: impl Into<Self::G2Prepared>,
) -> PairingOutput<Self>
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.