# Bitcoinex.Secp256k1.Math (bitcoinex v0.1.6) View Source

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

View Source

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

# inv(x, n)

View Source

## Specs

`inv(integer(), pos_integer()) :: integer()`

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

# modulo(x, n)

View Source

## Specs

`modulo(integer(), integer()) :: integer()`

# multiply(p, n)

View Source

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

`pow(integer(), non_neg_integer()) :: integer()`