Skip to content

Instantly share code, notes, and snippets.

@preanhubert
preanhubert / curve_example.py
Created May 7, 2022 18:28 — forked from nlitsme/curve_example.py
example of bitcoin curve calculations in python
from __future__ import print_function, division
"""
Example of how calculations on the secp256k1 curve work.
secp256k1 is the name of the elliptic curve used by bitcoin
see http://bitcoin.stackexchange.com/questions/25382
"""
p = 2**256 - 2**32 - 977
def inverse(x, p):
"""