# `Tezex.Crypto.BLS.Fq`
[🔗](https://github.com/objkt-com/tezex/blob/v4.0.0/lib/crypto/bls/fq.ex#L1)

Base field Fq for BLS12-381.

This is the base field over which the BLS12-381 elliptic curves are defined.
Modulus: 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787

# `t`

```elixir
@type t() :: binary()
```

# `add`

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

Adds two field elements.

# `eq?`

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

Checks if two field elements are equal.

# `frobenius`

```elixir
@spec frobenius(t()) :: t()
```

Computes the Frobenius endomorphism φ: Fq → Fq where φ(x) = x^p.
For the base field Fq, this is the identity function since x^p ≡ x (mod p).

# `from_bytes`

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

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

# `from_integer`

```elixir
@spec from_integer(integer()) :: t()
```

Creates a field element from an integer.
Negative integers are converted to their positive modular equivalent.

# `inv`

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

Computes the modular inverse of a field element.
Returns {:ok, inverse} or {:error, :not_invertible} if the element is zero.

# `is_one?`

```elixir
@spec is_one?(t()) :: boolean()
```

Checks if a field element is one.

# `is_zero?`

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

Checks if a field element is zero.

# `modulus`

```elixir
@spec modulus() :: non_neg_integer()
```

Returns the field modulus.

# `mul`

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

Multiplies two field elements.

# `neg`

```elixir
@spec neg(t()) :: t()
```

Negates a field element.

# `one`

```elixir
@spec one() :: t()
```

One element of the field.

# `pow`

```elixir
@spec pow(t(), non_neg_integer()) :: t()
```

Raises a field element to a power.

# `random`

```elixir
@spec random() :: t()
```

Generates a random field element.

# `sqrt`

```elixir
@spec sqrt(t()) :: {:ok, t()} | {:error, :no_sqrt}
```

Computes the square root of a field element if it exists.

# `square`

```elixir
@spec square(t()) :: t()
```

Squares a field element.

# `sub`

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

Subtracts two field elements (a - b).

# `to_bytes`

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

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

# `to_integer`

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

Converts a field element to integer.

# `zero`

```elixir
@spec zero() :: t()
```

Zero element of the field.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
