Module elliptic_curve_functions

Source
Expand description

§Elliptic curve functions

This module defines jets that replicate the functional behavior of (a specific version of) libsecp256k1’s elliptic curve operations https://github.com/bitcoin-core/secp256k1/tree/v0.3.0. The functions defined here return precisely the same field and point representatives that the corresponding libsecp256k1’s functions do, with a few exceptions with the way the point at infinity is handled.

Functions§

decompress
Decompress a point into affine coordinates.
fe_add
Add two field elements.
fe_invert
Compute the modular inverse of a field element.
fe_is_odd
Check if the canonical representative of the field element is odd.
fe_is_zero
Check if the field element represents zero.
fe_multiply
Multiply two field elements.
fe_multiply_beta
Multiply a field element by the canonical primitive cube root of unity (beta).
fe_negate
Negate a field element.
fe_normalize
Return the canonical representation of a field element.
fe_square
Square a field element.
fe_square_root
Compute the modular square root of a field element if it exists.
ge_is_on_curve
Check if the given point satisfies the curve equation y² = x³ + 7.
ge_negate
Negate a point.
gej_add
Add two points.
gej_double
Double a point. If the result is the point at infinity, it is returned in canonical form.
gej_equiv
Check if two points represent the same point.
gej_ge_add
Add two points. If the result is the point at infinity, it is returned in canonical form.
gej_ge_add_ex
Add two points. Also return the ration of the as z-coordinate and the result’s z-coordinate. If the result is the point at infinity, it is returned in canonical form.
gej_ge_equiv
Check if two points represent the same point.
gej_infinity
Return the canonical representation of the point at infinity.
gej_is_infinity
Check if the point represents infinity.
gej_is_on_curve
Check if the given point satisfies the curve equation y² = x³ + 7.
gej_negate
Negate a point.
gej_normalize
Convert the point into affine coordinates with canonical field representatives. If the result is the point at infinity, it is returned in canonical form.
gej_rescale
Change the representatives of a point by multiplying the z-coefficient by the given value.
gej_x_equiv
Check if the point represents an affine point with the given x-coordinate.
gej_y_is_odd
Check if the point represents an affine point with odd y-coordinate.
generate
Multiply the generator point with the given scalar.
hash_to_curve
A cryptographic hash function that results in a point on the secp256k1 curve.
linear_combination_1
Compute the linear combination b * a + c * g for point b and scalars a and c, where g is the generator point.
linear_verify_1
Assert that a point b is equal to the linear combination a.0 * a.1 + a.2 * g, where g is the generator point.
point_verify_1
Assert that a point b is equal to the linear combination a.0 * a.1 + a.2 * g, where g is the generator point.
scalar_add
Add two scalars.
scalar_invert
Compute the modular inverse of a scalar.
scalar_is_zero
Check if the scalar represents zero.
scalar_multiply
Multiply two scalars.
scalar_multiply_lambda
Multiply a scalar with the canonical primitive cube of unity (lambda)
scalar_negate
Negate a scalar.
scalar_normalize
Return the canonical representation of the scalar.
scalar_square
Square a scalar.
scale
Multiply a point by a scalar.
swu
Algebraically distribute a field element over the secp256k1 curve as defined in “Indifferentiable Hashing to Barreto-Naehrig Curves” by Pierre-Alain Fouque, Mehdi Tibouchi.