Trait ark_r1cs_std::pairing::PairingVar
source · pub trait PairingVar<E: Pairing, ConstraintF: Field = <<E as Pairing>::G1 as CurveGroup>::BaseField> {
type G1Var: CurveVar<E::G1, ConstraintF> + AllocVar<E::G1, ConstraintF> + AllocVar<E::G1Affine, ConstraintF>;
type G2Var: CurveVar<E::G2, ConstraintF> + AllocVar<E::G2, ConstraintF> + AllocVar<E::G2Affine, ConstraintF>;
type GTVar: FieldVar<E::TargetField, ConstraintF>;
type G1PreparedVar: ToBytesGadget<ConstraintF> + AllocVar<E::G1Prepared, ConstraintF> + Clone + Debug;
type G2PreparedVar: ToBytesGadget<ConstraintF> + AllocVar<E::G2Prepared, ConstraintF> + Clone + Debug;
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>;
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§
sourcetype G1Var: CurveVar<E::G1, ConstraintF> + AllocVar<E::G1, ConstraintF> + AllocVar<E::G1Affine, ConstraintF>
type G1Var: CurveVar<E::G1, ConstraintF> + AllocVar<E::G1, ConstraintF> + AllocVar<E::G1Affine, ConstraintF>
An variable representing an element of G1
.
This is the R1CS equivalent of E::G1Projective
.
sourcetype G2Var: CurveVar<E::G2, ConstraintF> + AllocVar<E::G2, ConstraintF> + AllocVar<E::G2Affine, ConstraintF>
type G2Var: CurveVar<E::G2, ConstraintF> + AllocVar<E::G2, ConstraintF> + AllocVar<E::G2Affine, ConstraintF>
An variable representing an element of G2
.
This is the R1CS equivalent of E::G2Projective
.
sourcetype GTVar: FieldVar<E::TargetField, ConstraintF>
type GTVar: FieldVar<E::TargetField, ConstraintF>
An variable representing an element of GT
.
This is the R1CS equivalent of E::GT
.
sourcetype G1PreparedVar: ToBytesGadget<ConstraintF> + AllocVar<E::G1Prepared, ConstraintF> + Clone + Debug
type G1PreparedVar: ToBytesGadget<ConstraintF> + AllocVar<E::G1Prepared, ConstraintF> + Clone + Debug
An variable representing cached precomputation that can speed up
pairings computations. This is the R1CS equivalent of
E::G1Prepared
.
sourcetype G2PreparedVar: ToBytesGadget<ConstraintF> + AllocVar<E::G2Prepared, ConstraintF> + Clone + Debug
type G2PreparedVar: ToBytesGadget<ConstraintF> + AllocVar<E::G2Prepared, ConstraintF> + Clone + Debug
An variable representing cached precomputation that can speed up
pairings computations. This is the R1CS equivalent of
E::G2Prepared
.
Required Methods§
sourcefn miller_loop(
p: &[Self::G1PreparedVar],
q: &[Self::G2PreparedVar]
) -> Result<Self::GTVar, SynthesisError>
fn miller_loop(
p: &[Self::G1PreparedVar],
q: &[Self::G2PreparedVar]
) -> Result<Self::GTVar, SynthesisError>
Computes a multi-miller loop between elements
of p
and q
.
sourcefn final_exponentiation(p: &Self::GTVar) -> Result<Self::GTVar, SynthesisError>
fn final_exponentiation(p: &Self::GTVar) -> Result<Self::GTVar, SynthesisError>
Computes a final exponentiation over p
.
sourcefn prepare_g1(q: &Self::G1Var) -> Result<Self::G1PreparedVar, SynthesisError>
fn prepare_g1(q: &Self::G1Var) -> Result<Self::G1PreparedVar, SynthesisError>
Performs the precomputation to generate Self::G1PreparedVar
.
sourcefn prepare_g2(q: &Self::G2Var) -> Result<Self::G2PreparedVar, SynthesisError>
fn prepare_g2(q: &Self::G2Var) -> Result<Self::G2PreparedVar, SynthesisError>
Performs the precomputation to generate Self::G2PreparedVar
.
Provided Methods§
sourcefn pairing(
p: Self::G1PreparedVar,
q: Self::G2PreparedVar
) -> Result<Self::GTVar, SynthesisError>
fn pairing(
p: Self::G1PreparedVar,
q: Self::G2PreparedVar
) -> Result<Self::GTVar, SynthesisError>
Computes a pairing over p
and q
.
sourcefn product_of_pairings(
p: &[Self::G1PreparedVar],
q: &[Self::G2PreparedVar]
) -> Result<Self::GTVar, SynthesisError>
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
.