pairing

Trait Engine

Source
pub trait Engine:
    Sized
    + 'static
    + Clone
    + Sync
    + Send
    + Debug {
    type Fr: PrimeField;
    type G1: PrimeCurve<Scalar = Self::Fr, Affine = Self::G1Affine> + From<Self::G1Affine> + GroupOps<Self::G1Affine> + GroupOpsOwned<Self::G1Affine> + ScalarMul<Self::Fr> + ScalarMulOwned<Self::Fr>;
    type G1Affine: PairingCurveAffine<Scalar = Self::Fr, Curve = Self::G1, Pair = Self::G2Affine, PairingResult = Self::Gt> + From<Self::G1> + Mul<Self::Fr, Output = Self::G1> + for<'a> Mul<&'a Self::Fr, Output = Self::G1>;
    type G2: PrimeCurve<Scalar = Self::Fr, Affine = Self::G2Affine> + From<Self::G2Affine> + GroupOps<Self::G2Affine> + GroupOpsOwned<Self::G2Affine> + ScalarMul<Self::Fr> + ScalarMulOwned<Self::Fr>;
    type G2Affine: PairingCurveAffine<Scalar = Self::Fr, Curve = Self::G2, Pair = Self::G1Affine, PairingResult = Self::Gt> + From<Self::G2> + Mul<Self::Fr, Output = Self::G2> + for<'a> Mul<&'a Self::Fr, Output = Self::G2>;
    type Gt: Group<Scalar = Self::Fr> + ScalarMul<Self::Fr> + ScalarMulOwned<Self::Fr>;

    // Required method
    fn pairing(p: &Self::G1Affine, q: &Self::G2Affine) -> Self::Gt;
}
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§

Source

type Fr: PrimeField

This is the scalar field of the engine’s groups.

Source

type G1: PrimeCurve<Scalar = Self::Fr, Affine = Self::G1Affine> + From<Self::G1Affine> + GroupOps<Self::G1Affine> + GroupOpsOwned<Self::G1Affine> + ScalarMul<Self::Fr> + ScalarMulOwned<Self::Fr>

The projective representation of an element in G1.

Source

type G1Affine: PairingCurveAffine<Scalar = Self::Fr, Curve = Self::G1, Pair = Self::G2Affine, PairingResult = Self::Gt> + From<Self::G1> + Mul<Self::Fr, Output = Self::G1> + for<'a> Mul<&'a Self::Fr, Output = Self::G1>

The affine representation of an element in G1.

Source

type G2: PrimeCurve<Scalar = Self::Fr, Affine = Self::G2Affine> + From<Self::G2Affine> + GroupOps<Self::G2Affine> + GroupOpsOwned<Self::G2Affine> + ScalarMul<Self::Fr> + ScalarMulOwned<Self::Fr>

The projective representation of an element in G2.

Source

type G2Affine: PairingCurveAffine<Scalar = Self::Fr, Curve = Self::G2, Pair = Self::G1Affine, PairingResult = Self::Gt> + From<Self::G2> + Mul<Self::Fr, Output = Self::G2> + for<'a> Mul<&'a Self::Fr, Output = Self::G2>

The affine representation of an element in G2.

Source

type Gt: Group<Scalar = Self::Fr> + ScalarMul<Self::Fr> + ScalarMulOwned<Self::Fr>

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

Required Methods§

Source

fn pairing(p: &Self::G1Affine, q: &Self::G2Affine) -> Self::Gt

Invoke the pairing function G1 x G2 -> Gt without the use of precomputation and other optimizations.

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§