Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PairingCheck ¶
Computes the following relation: ∏ᵢ e(Pᵢ, Qᵢ) =? 1
To explain why gnark returns a (bool, error):
- If the function `e` does not return a result then internally an error is returned.
- If `e` returns a result, then error will be nil, but if this value is not `1` then the boolean value will be false
We therefore check for an error, and return false if its non-nil and then return the value of the boolean if not.
Types ¶
type G1 ¶
type G1 struct {
// contains filtered or unexported fields
}
G1 is the affine representation of a G1 group element.
Since this code is used for precompiles, using Jacobian points are not beneficial because there are no intermediate points to allow us to save on inversions.
Note: We also use this struct so that we can conform to the existing API that the precompiles want.
func (*G1) Marshal ¶
Marshal serializes the point into a byte slice.
Note: The point is serialized as uncompressed.
func (*G1) ScalarMult ¶
ScalarMult computes the scalar multiplication between `a` and `scalar`, storing the result in `g`
func (*G1) Unmarshal ¶
Unmarshal deserializes `buf` into `g`
Note: whether the deserialization is of a compressed or an uncompressed point, is encoded in the bytes.
For our purpose, the point will always be serialized as uncompressed, ie 64 bytes.
This method also checks whether the point is on the curve and in the prime order subgroup.
type G2 ¶
type G2 struct {
// contains filtered or unexported fields
}
G2 is the affine representation of a G2 group element.
Since this code is used for precompiles, using Jacobian points are not beneficial because there are no intermediate points and G2 in particular is only used for the pairing input.
Note: We also use this struct so that we can conform to the existing API that the precompiles want.
func (*G2) Marshal ¶
Marshal serializes the point into a byte slice.
Note: The point is serialized as uncompressed.
func (*G2) Unmarshal ¶
Unmarshal deserializes `buf` into `g`
Note: whether the deserialization is of a compressed or an uncompressed point, is encoded in the bytes.
For our purpose, the point will always be serialized as uncompressed, ie 128 bytes.
This method also checks whether the point is on the curve and in the prime order subgroup.
type GT ¶
type GT struct {
// contains filtered or unexported fields
}
GT is the affine representation of a GT field element.
Note: GT is not explicitly used in mainline code. It is needed for fuzzing.
func Pair ¶
Pair compute the optimal Ate pairing between a G1 and G2 element.
Note: This method is not explicitly used in mainline code. It is needed for fuzzing. It should also be noted, that the output of this function may not match other
func (*GT) Exp ¶
Exp raises `base` to the power of `exponent`
Note: This method is not explicitly used in mainline code. It is needed for fuzzing.