pub trait Engine: ScalarEngine {
type G1: CurveProjective<Engine = Self, Base = Self::Fq, Scalar = Self::Fr, Affine = Self::G1Affine> + From<Self::G1Affine>;
type G1Affine: CurveAffine<Engine = Self, Base = Self::Fq, Scalar = Self::Fr, Projective = Self::G1, Pair = Self::G2Affine, PairingResult = Self::Fqk> + From<Self::G1>;
type G2: CurveProjective<Engine = Self, Base = Self::Fqe, Scalar = Self::Fr, Affine = Self::G2Affine> + From<Self::G2Affine>;
type G2Affine: CurveAffine<Engine = Self, Base = Self::Fqe, Scalar = Self::Fr, Projective = Self::G2, Pair = Self::G1Affine, PairingResult = Self::Fqk> + From<Self::G2>;
type Fq: PrimeField + SqrtField;
type Fqe: SqrtField;
type Fqk: Field;
// Required methods
fn miller_loop<'a, I>(i: I) -> Self::Fqk
where I: IntoIterator<Item = &'a (&'a <Self::G1Affine as CurveAffine>::Prepared, &'a <Self::G2Affine as CurveAffine>::Prepared)>;
fn final_exponentiation(_: &Self::Fqk) -> Option<Self::Fqk>;
// Provided methods
fn pairing<G1, G2>(p: G1, q: G2) -> Self::Fqk
where G1: Into<Self::G1Affine>,
G2: Into<Self::G2Affine> { ... }
fn pairing_product<G1, G2>(p1: G1, q1: G2, p2: G1, q2: G2) -> Self::Fqk
where G1: Into<Self::G1Affine>,
G2: Into<Self::G2Affine> { ... }
fn pairing_multi_product(
p: &[Self::G1Affine],
q: &[Self::G2Affine],
) -> Self::Fqk { ... }
}
Expand description
An “engine” is a collection of types (fields, elliptic curve groups, etc.)
with well-defined relationships. In particular, the G1/G2 curve groups are
of prime order r
, and are equipped with a bilinear pairing function.
Required Associated Types§
Sourcetype G1: CurveProjective<Engine = Self, Base = Self::Fq, Scalar = Self::Fr, Affine = Self::G1Affine> + From<Self::G1Affine>
type G1: CurveProjective<Engine = Self, Base = Self::Fq, Scalar = Self::Fr, Affine = Self::G1Affine> + From<Self::G1Affine>
The projective representation of an element in G1.
Sourcetype G1Affine: CurveAffine<Engine = Self, Base = Self::Fq, Scalar = Self::Fr, Projective = Self::G1, Pair = Self::G2Affine, PairingResult = Self::Fqk> + From<Self::G1>
type G1Affine: CurveAffine<Engine = Self, Base = Self::Fq, Scalar = Self::Fr, Projective = Self::G1, Pair = Self::G2Affine, PairingResult = Self::Fqk> + From<Self::G1>
The affine representation of an element in G1.
Sourcetype G2: CurveProjective<Engine = Self, Base = Self::Fqe, Scalar = Self::Fr, Affine = Self::G2Affine> + From<Self::G2Affine>
type G2: CurveProjective<Engine = Self, Base = Self::Fqe, Scalar = Self::Fr, Affine = Self::G2Affine> + From<Self::G2Affine>
The projective representation of an element in G2.
Sourcetype G2Affine: CurveAffine<Engine = Self, Base = Self::Fqe, Scalar = Self::Fr, Projective = Self::G2, Pair = Self::G1Affine, PairingResult = Self::Fqk> + From<Self::G2>
type G2Affine: CurveAffine<Engine = Self, Base = Self::Fqe, Scalar = Self::Fr, Projective = Self::G2, Pair = Self::G1Affine, PairingResult = Self::Fqk> + From<Self::G2>
The affine representation of an element in G2.
Sourcetype Fq: PrimeField + SqrtField
type Fq: PrimeField + SqrtField
The base field that hosts G1.
Required Methods§
Sourcefn miller_loop<'a, I>(i: I) -> Self::Fqkwhere
I: IntoIterator<Item = &'a (&'a <Self::G1Affine as CurveAffine>::Prepared, &'a <Self::G2Affine as CurveAffine>::Prepared)>,
fn miller_loop<'a, I>(i: I) -> Self::Fqkwhere
I: IntoIterator<Item = &'a (&'a <Self::G1Affine as CurveAffine>::Prepared, &'a <Self::G2Affine as CurveAffine>::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 pairing_product<G1, G2>(p1: G1, q1: G2, p2: G1, q2: G2) -> Self::Fqk
fn pairing_product<G1, G2>(p1: G1, q1: G2, p2: G1, q2: G2) -> Self::Fqk
performs a pairing product operation with a single “final exponentiation”
Sourcefn pairing_multi_product(
p: &[Self::G1Affine],
q: &[Self::G2Affine],
) -> Self::Fqk
fn pairing_multi_product( p: &[Self::G1Affine], q: &[Self::G2Affine], ) -> Self::Fqk
performs a multi-pairing product operation with a single “final exponentiation”
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.