Tezex.Crypto.BLS.G1 (tezex v3.2.0)

View Source

G1 elliptic curve group for BLS12-381.

This is the elliptic curve E(Fq): y² = x³ + 4 over the base field Fq. G1 is used for public keys in BLS signatures.

Points are represented in projective coordinates (X, Y, Z) where:

  • Affine coordinates: (X/Z, Y/Z) - standard projective coordinate system
  • Point at infinity: (1, 1, 0)

Summary

Functions

Adds two G1 points using standard elliptic curve addition.

Doubles a G1 point.

Checks if two G1 points are equal.

Creates a G1 point from affine coordinates.

Deserializes a G1 point from compressed format (48 bytes).

Returns the generator point for G1.

Alias for is_zero?/1 for compatibility.

Checks if a point is on the curve using Jacobian coordinates. Standard curve equation: y² z = x³ + b

Checks if a point is the point at infinity.

Multiplies a G1 point by a scalar using binary "double-and-add".

Negates a G1 point.

Creates a G1 point from Jacobian coordinates.

Converts a G1 point to affine coordinates using projective coordinate system where affine = (x/z, y/z), not Jacobian (x/z^2, y/z^3).

Serializes a G1 point to compressed format (48 bytes).

Returns the point at infinity (identity element).

Types

Functions

add(p1, p2)

@spec add(t(), t()) :: t()

Adds two G1 points using standard elliptic curve addition.

double(point)

@spec double(t()) :: t()

Doubles a G1 point.

eq?(p1, p2)

@spec eq?(t(), t()) :: boolean()

Checks if two G1 points are equal.

from_affine(x, y)

@spec from_affine(Tezex.Crypto.BLS.Fq.t(), Tezex.Crypto.BLS.Fq.t()) :: t()

Creates a G1 point from affine coordinates.

from_compressed_bytes(bytes)

@spec from_compressed_bytes(binary()) :: {:ok, t()} | {:error, :invalid_point}

Deserializes a G1 point from compressed format (48 bytes).

generator()

@spec generator() :: t()

Returns the generator point for G1.

is_infinity?(point)

@spec is_infinity?(t()) :: boolean()

Alias for is_zero?/1 for compatibility.

is_on_curve?(point)

@spec is_on_curve?(t()) :: boolean()

Checks if a point is on the curve using Jacobian coordinates. Standard curve equation: y² z = x³ + b

is_zero?(map)

@spec is_zero?(t()) :: boolean()

Checks if a point is the point at infinity.

mul(point, scalar)

@spec mul(t(), Tezex.Crypto.BLS.Fr.t()) :: t()

Multiplies a G1 point by a scalar using binary "double-and-add".

negate(point)

@spec negate(t()) :: t()

Negates a G1 point.

new(x, y, z)

Creates a G1 point from Jacobian coordinates.

to_affine(point)

@spec to_affine(t()) ::
  {:ok, {Tezex.Crypto.BLS.Fq.t(), Tezex.Crypto.BLS.Fq.t()}}
  | {:error, :point_at_infinity}

Converts a G1 point to affine coordinates using projective coordinate system where affine = (x/z, y/z), not Jacobian (x/z^2, y/z^3).

to_compressed_bytes(point)

@spec to_compressed_bytes(t()) :: binary()

Serializes a G1 point to compressed format (48 bytes).

zero()

@spec zero() :: t()

Returns the point at infinity (identity element).