Basic arithmetic operations for points on elliptic curves.
This package provides basic arithmethic point operations on elliptic curves. The following operations for points are available:
- order of point (for fair points)
The following curves are already implemented:
It is also possible to define your own curve.
pip install PyECCArithmetic
from PyECCArithmetic import Point from PyECCArithmetic import Curve p = Point(x_1, y_1, curve=Curve.secp256r1()) q = Point(x_2, y_2, curve=Curve.secp256r1()) z = p + q # z is a new point
from PyECCArithmetic import Point p = Point(x_1, y_1) # curve defaults to Curve.secp256r1() q = Point(x_2, y_2) z = p - q # z = p + (-q), z is a point
Multiplication is realised with the double and add algorithm.
from PyECCArithmetic import Point p = Point(x_1, y_1) # curve defaults to Curve.secp256r1() z = p * 3 # z is a new point
from PyECCArithmetic import Point p = Point(x_1, y_1) # curve defaults to Curve.secp256r1() q = Point(x_2, y_2) z = p / q # z is int, such that z * q == p
from PyECCArithmetic import Point p = Point(x_1, y_1) # curve defaults to Curve.secp256r1() order = p.order(timeout=5) # tries to calculate the order for maximal timeout seconds
Custom curve definition
from PyECCArithmetic import Curve # Only curves defined as Weierstrass equation are supported # y^2 = x^3 + a * x + b mod p c = Curve(a, b, p, name='optional')
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pyECCArithmetic-1.0.0-py3-none-any.whl (7.2 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size pyECCArithmetic-1.0.0.tar.gz (5.6 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for pyECCArithmetic-1.0.0-py3-none-any.whl