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
a
s 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 pointb
and scalarsa
andc
, whereg
is the generator point. - linear_
verify_ 1 - Assert that a point
b
is equal to the linear combinationa.0 * a.1 + a.2 * g
, whereg
is the generator point. - point_
verify_ 1 - Assert that a point
b
is equal to the linear combinationa.0 * a.1 + a.2 * g
, whereg
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.