View Source Bitcoinex.Secp256k1.Math (bitcoinex v0.1.8)

Contains math utilities when dealing with secp256k1 curve points and scalars.

All of the addition and multiplication uses the secp256k1 curve paramaters.

Several of the jacobian multiplication and addition functions are borrowed heavily from https://github.com/starkbank/ecdsa-elixir/.

Link to this section Summary

Functions

add accepts points p and q and, does jacobian addition to return resulting point.

Inv performs the Extended Euclidean Algorithm to find the inverse of a number x mod n.

multiply accepts a point P and scalar n and, does jacobian multiplication to return resulting point.

pow performs integer pow, where x is raised to the power of y.

Link to this section Functions

add accepts points p and q and, does jacobian addition to return resulting point.

@spec inv(integer(), pos_integer()) :: integer()

Inv performs the Extended Euclidean Algorithm to find the inverse of a number x mod n.

@spec modulo(integer(), integer()) :: integer()

multiply accepts a point P and scalar n and, does jacobian multiplication to return resulting point.

pow performs integer pow, where x is raised to the power of y.