Tezex.Crypto.BLS.FqP (tezex v5.0.0)

Copy Markdown View Source

Polynomial extension field base class for BLS12-381. This is the base for building higher-degree extension fields like Fq12.

Summary

Functions

Adds two polynomial field elements.

Checks if two elements are equal.

Computes the modular inverse using the extended Euclidean algorithm. Returns {:ok, inverse} or {:error, :not_invertible} if the element is zero.

Multiplies two polynomial field elements with modular reduction. This implementation uses an optimized multiplication algorithm.

Negates a polynomial field element.

Creates a polynomial extension field element from coefficients.

Returns the one element.

Subtracts two polynomial field elements.

Returns the zero element.

Checks if the element is zero.

Types

t()

@type t() :: %{coeffs: [Tezex.Crypto.BLS.Fq.t()], modulus_coeffs: [integer()]}

Functions

add(map1, map2)

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

Adds two polynomial field elements.

eq?(map1, map2)

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

Checks if two elements are equal.

inv(elem)

@spec inv(t()) :: {:ok, t()} | {:error, :not_invertible}

Computes the modular inverse using the extended Euclidean algorithm. Returns {:ok, inverse} or {:error, :not_invertible} if the element is zero.

mul(map1, map2)

@spec mul(t(), t()) :: t()

Multiplies two polynomial field elements with modular reduction. This implementation uses an optimized multiplication algorithm.

neg(map)

@spec neg(t()) :: t()

Negates a polynomial field element.

new(coeffs, modulus_coeffs)

@spec new([Tezex.Crypto.BLS.Fq.t()], [integer()]) :: t()

Creates a polynomial extension field element from coefficients.

one(modulus_coeffs)

@spec one([integer()]) :: t()

Returns the one element.

sub(map1, map2)

@spec sub(t(), t()) :: t()

Subtracts two polynomial field elements.

zero(modulus_coeffs)

@spec zero([integer()]) :: t()

Returns the zero element.

zero?(map)

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

Checks if the element is zero.