ark_r1cs_std::pairing

Trait PairingVar

Source
pub trait PairingVar<E: Pairing> {
    type G1Var: CurveVar<E::G1, <<E as Pairing>::BaseField as Field>::BasePrimeField>;
    type G2Var: CurveVar<E::G2, <<E as Pairing>::BaseField as Field>::BasePrimeField>;
    type GTVar: FieldVar<E::TargetField, <<E as Pairing>::BaseField as Field>::BasePrimeField>;
    type G1PreparedVar: ToBytesGadget<<<E as Pairing>::BaseField as Field>::BasePrimeField> + AllocVar<E::G1Prepared, <<E as Pairing>::BaseField as Field>::BasePrimeField> + Clone + Debug;
    type G2PreparedVar: ToBytesGadget<<<E as Pairing>::BaseField as Field>::BasePrimeField> + AllocVar<E::G2Prepared, <<E as Pairing>::BaseField as Field>::BasePrimeField> + Clone + Debug;

    // Required methods
    fn miller_loop(
        p: &[Self::G1PreparedVar],
        q: &[Self::G2PreparedVar],
    ) -> Result<Self::GTVar, SynthesisError>;
    fn final_exponentiation(
        p: &Self::GTVar,
    ) -> Result<Self::GTVar, SynthesisError>;
    fn prepare_g1(
        q: &Self::G1Var,
    ) -> Result<Self::G1PreparedVar, SynthesisError>;
    fn prepare_g2(
        q: &Self::G2Var,
    ) -> Result<Self::G2PreparedVar, SynthesisError>;

    // Provided methods
    fn pairing(
        p: Self::G1PreparedVar,
        q: Self::G2PreparedVar,
    ) -> Result<Self::GTVar, SynthesisError> { ... }
    fn product_of_pairings(
        p: &[Self::G1PreparedVar],
        q: &[Self::G2PreparedVar],
    ) -> Result<Self::GTVar, SynthesisError> { ... }
}
Expand description

Specifies the constraints for computing a pairing in the yybilinear group E.

Required Associated Types§

Source

type G1Var: CurveVar<E::G1, <<E as Pairing>::BaseField as Field>::BasePrimeField>

An variable representing an element of G1. This is the R1CS equivalent of E::G1Projective.

Source

type G2Var: CurveVar<E::G2, <<E as Pairing>::BaseField as Field>::BasePrimeField>

An variable representing an element of G2. This is the R1CS equivalent of E::G2Projective.

Source

type GTVar: FieldVar<E::TargetField, <<E as Pairing>::BaseField as Field>::BasePrimeField>

An variable representing an element of GT. This is the R1CS equivalent of E::GT.

Source

type G1PreparedVar: ToBytesGadget<<<E as Pairing>::BaseField as Field>::BasePrimeField> + AllocVar<E::G1Prepared, <<E as Pairing>::BaseField as Field>::BasePrimeField> + Clone + Debug

An variable representing cached precomputation that can speed up pairings computations. This is the R1CS equivalent of E::G1Prepared.

Source

type G2PreparedVar: ToBytesGadget<<<E as Pairing>::BaseField as Field>::BasePrimeField> + AllocVar<E::G2Prepared, <<E as Pairing>::BaseField as Field>::BasePrimeField> + Clone + Debug

An variable representing cached precomputation that can speed up pairings computations. This is the R1CS equivalent of E::G2Prepared.

Required Methods§

Source

fn miller_loop( p: &[Self::G1PreparedVar], q: &[Self::G2PreparedVar], ) -> Result<Self::GTVar, SynthesisError>

Computes a multi-miller loop between elements of p and q.

Source

fn final_exponentiation(p: &Self::GTVar) -> Result<Self::GTVar, SynthesisError>

Computes a final exponentiation over p.

Source

fn prepare_g1(q: &Self::G1Var) -> Result<Self::G1PreparedVar, SynthesisError>

Performs the precomputation to generate Self::G1PreparedVar.

Source

fn prepare_g2(q: &Self::G2Var) -> Result<Self::G2PreparedVar, SynthesisError>

Performs the precomputation to generate Self::G2PreparedVar.

Provided Methods§

Source

fn pairing( p: Self::G1PreparedVar, q: Self::G2PreparedVar, ) -> Result<Self::GTVar, SynthesisError>

Computes a pairing over p and q.

Source

fn product_of_pairings( p: &[Self::G1PreparedVar], q: &[Self::G2PreparedVar], ) -> Result<Self::GTVar, SynthesisError>

Computes a product of pairings over the elements in p and q.

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> PairingVar<Bls12<P>> for ark_r1cs_std::pairing::bls12::PairingVar<P>

Source§

impl<P: MNT4Config> PairingVar<MNT4<P>> for ark_r1cs_std::pairing::mnt4::PairingVar<P>

Source§

impl<P: MNT6Config> PairingVar<MNT6<P>> for ark_r1cs_std::pairing::mnt6::PairingVar<P>