Given two GF(p^5) elements on stack, this routine computes modular
addition over extension field GF(p^5) s.t. p = 2^64 - 2^32 + 1

Expected stack state :

[a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, ...]

After application of routine stack :

[c0, c1, c2, c3, c4, ...] s.t. c = a + b

See section 3.2 of https://eprint.iacr.org/2022/274.pdf

For reference implementation in high level language, see
https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L607-L616
## std::math::ecgfp5::base_field | Procedure | Description | | ----------- | ------------- | | sub | Given two GF(p^5) elements on stack, this routine subtracts second
element from first one, over extension field GF(p^5) s.t. p = 2^64 - 2^32 + 1

Expected stack state :

[a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, ...]

After application of routine stack :

[c0, c1, c2, c3, c4, ...] s.t. c = a - b

See section 3.2 of https://eprint.iacr.org/2022/274.pdf

For reference implementation in high level language, see
https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L629-L638
| | mul | Given two GF(p^5) elements on stack, this routine computes modular
multiplication ( including reduction by irreducible polynomial )
over extension field GF(p^5) s.t. p = 2^64 - 2^32 + 1

Expected stack state :

[a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, ...]

After application of routine stack :

[c0, c1, c2, c3, c4, ...] s.t. c = a * b

See section 3.2 of https://eprint.iacr.org/2022/274.pdf

For reference implementation in high level language, see
https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L676-L689
| | square | Given one GF(p^5) element on stack, this routine computes modular
squaring ( including reduction by irreducible polynomial )
over extension field GF(p^5) s.t. p = 2^64 - 2^32 + 1

This routine has same effect as calling mul(a, a) \| a ∈ GF(p^5)

Expected stack state :

[a0, a1, a2, a3, a4, ...]

After application of routine stack :

[b0, b1, b2, b3, b4, ...] s.t. b = a * a

See section 3.2 of https://eprint.iacr.org/2022/274.pdf

For reference implementation in high level language, see
https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L709-L715
| | inv | Given one GF(p^5) element on stack, this routine computes multiplicative
inverse over extension field GF(p^5) s.t. p = 2^64 - 2^32 + 1

Expected stack state :

[a0, a1, a2, a3, a4, ...]

After application of routine stack :

[b0, b1, b2, b3, b4, ...] s.t. b = 1 / a

See section 3.2 of https://eprint.iacr.org/2022/274.pdf

For reference implementation in high level language, see
https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L751-L775

Note, this routine will not panic even when operand `a` is zero.
| | div | Given two GF(p^5) elements ( say a, b ) on stack, this routine computes
modular division over extension field GF(p^5) s.t. p = 2^64 - 2^32 + 1

Expected stack state :

[a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, ...]

After application of routine stack :

[c0, c1, c2, c3, c4, ...] s.t. c = a / b

See section 3.2 of https://eprint.iacr.org/2022/274.pdf

For reference implementation in high level language, see
https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L777-L781
| | legendre | Given an element v ∈ GF(p^5), this routine computes its legendre symbol,
which is an element ∈ GF(p) \| p = 2^64 - 2^32 + 1

At beginning stack looks like

[a0, a1, a2, a3, a4, ...]

At end stack looks like

[b, ...] s.t. b = legendre symbol of a

See https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L857-L877
for reference implementation in higher level language.
| | sqrt | Given an element v ∈ GF(p^5), this routine attempts to compute square root of v,
if that number is a square.

At beginning stack looks like

[a0, a1, a2, a3, a4, ...]

At end stack looks like

[b0, b1, b2, b3, b4, flg, ...]

If flg = 1, it denotes v' = {b0, b1, b2, b3, b4} is square root of v i.e. v' * v' = v ( mod GF(p^5) )
If flg = 0, then v' = {0, 0, 0, 0, 0}, denoting v doesn't have a square root

See https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L879-L910
for reference implementation in higher level language.
| | eq | Given two elements a, b ∈ GF(p^5), this routine produces single field element r,
denoting whether a == b.

Expected stack state

[a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, ...]

Final stack state

[r, ...]

If a == b { r = 1 } Else { r = 0 }

See https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L797-L806
for reference implementation.
| | neq | Given two elements a, b ∈ GF(p^5), this routine produces single field element r,
denoting whether a != b.

Expected stack state

[a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, ...]

Final stack state

[r, ...]

If a != b { r = 1 } Else { r = 0 }

See https://github.com/pornin/ecgfp5/blob/ce059c6/python/ecGFp5.py#L813-L822
for reference implementation.
|