Tezex.Crypto.BLS.G2 (tezex v3.2.0)
View SourceG2 elliptic curve group for BLS12-381.
This is the elliptic curve E'(Fq2): y² = x³ + 4(1 + u) over the quadratic extension Fq2. G2 is used for signatures in BLS signatures.
Points are represented in Jacobian coordinates (X, Y, Z) where:
- Affine coordinates: (X/Z², Y/Z³) over Fq2
- Point at infinity: (1, 1, 0)
Summary
Functions
Adds two G2 points.
Clear the cofactor of a G2 point to map it to the prime-order subgroup. Uses the efficient cofactor H_EFF_G2.
Doubles a G2 point.
Checks if two G2 points are equal.
Creates a G2 point from affine coordinates.
Deserializes a G2 point from compressed format (96 bytes).
Returns the generator point for G2.
Hash-to-curve for G2 - maps a message to a point on G2. Implements hash-to-curve following IRTF standards.
Alias for is_zero?/1 for compatibility.
Checks if a point is on the curve.
Checks if a point is the point at infinity.
Isogeny mapping from 3-isogenous curve to G2. 3-isogeny mapping from E'(Fq2) to E(Fq2).
Multiplies a G2 point by a scalar using double-and-add algorithm.
Multiplies a G2 point by a large integer (for cofactor clearing).
Negates a G2 point.
Creates a G2 point from Jacobian coordinates.
Optimized SSWU Map for G2. Maps an FQ2 element to a point on the 3-isogenous curve.
Converts a G2 point to affine coordinates.
Serializes a G2 point to compressed format (96 bytes).
Returns the point at infinity (identity element).
Types
@type t() :: %{ x: Tezex.Crypto.BLS.Fq2.t(), y: Tezex.Crypto.BLS.Fq2.t(), z: Tezex.Crypto.BLS.Fq2.t() }
Functions
Adds two G2 points.
Clear the cofactor of a G2 point to map it to the prime-order subgroup. Uses the efficient cofactor H_EFF_G2.
Doubles a G2 point.
Checks if two G2 points are equal.
@spec from_affine(Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t()) :: t()
Creates a G2 point from affine coordinates.
Deserializes a G2 point from compressed format (96 bytes).
@spec generator() :: t()
Returns the generator point for G2.
Hash-to-curve for G2 - maps a message to a point on G2. Implements hash-to-curve following IRTF standards.
Alias for is_zero?/1 for compatibility.
Checks if a point is on the curve.
Checks if a point is the point at infinity.
@spec iso_map_g2( Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t() ) :: {Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t()}
Isogeny mapping from 3-isogenous curve to G2. 3-isogeny mapping from E'(Fq2) to E(Fq2).
@spec mul(t(), Tezex.Crypto.BLS.Fr.t()) :: t()
Multiplies a G2 point by a scalar using double-and-add algorithm.
@spec mul_integer(t(), non_neg_integer()) :: t()
Multiplies a G2 point by a large integer (for cofactor clearing).
Negates a G2 point.
@spec new( Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t() ) :: t()
Creates a G2 point from Jacobian coordinates.
@spec sswu_map(Tezex.Crypto.BLS.Fq2.t()) :: {Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t()}
Optimized SSWU Map for G2. Maps an FQ2 element to a point on the 3-isogenous curve.
@spec to_affine(t()) :: {:ok, {Tezex.Crypto.BLS.Fq2.t(), Tezex.Crypto.BLS.Fq2.t()}} | {:error, :point_at_infinity}
Converts a G2 point to affine coordinates.
Serializes a G2 point to compressed format (96 bytes).
@spec zero() :: t()
Returns the point at infinity (identity element).