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§
Sourcetype G1Var: CurveVar<E::G1, <<E as Pairing>::BaseField as Field>::BasePrimeField>
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
.
Sourcetype G2Var: CurveVar<E::G2, <<E as Pairing>::BaseField as Field>::BasePrimeField>
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
.
Sourcetype GTVar: FieldVar<E::TargetField, <<E as Pairing>::BaseField as Field>::BasePrimeField>
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
.
Sourcetype G1PreparedVar: ToBytesGadget<<<E as Pairing>::BaseField as Field>::BasePrimeField> + AllocVar<E::G1Prepared, <<E as Pairing>::BaseField as Field>::BasePrimeField> + Clone + Debug
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
.
Sourcetype G2PreparedVar: ToBytesGadget<<<E as Pairing>::BaseField as Field>::BasePrimeField> + AllocVar<E::G2Prepared, <<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
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
.
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.