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

View Source

Scalar field Fr for BLS12-381 (curve order).

This is the field of scalars used for private keys and in elliptic curve operations.

Summary

Functions

Creates a field element from a binary (32 bytes, big-endian).

Creates a field element from an integer.

Checks if a field element is zero.

One element of the field.

Converts a field element to 32-byte big-endian binary.

Converts a field element to integer.

Zero element of the field.

Types

t()

@type t() :: binary()

Functions

from_bytes(bytes)

@spec from_bytes(binary()) :: {:ok, t()} | {:error, :invalid_size}

Creates a field element from a binary (32 bytes, big-endian).

from_integer(n)

@spec from_integer(non_neg_integer()) :: t()

Creates a field element from an integer.

is_zero?(fr)

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

Checks if a field element is zero.

one()

@spec one() :: t()

One element of the field.

to_bytes(fr)

@spec to_bytes(t()) :: binary()

Converts a field element to 32-byte big-endian binary.

to_integer(fr)

@spec to_integer(t()) :: non_neg_integer()

Converts a field element to integer.

zero()

@spec zero() :: t()

Zero element of the field.