Basic arithmetic operations for points on elliptic curves.
Project description
PyECCArithmetic
This package provides basic arithmethic point operations on elliptic curves. The following operations for points are available:
- Addition
- Subtraction
- Multiplication
- Division
- Order of point (for fair points)
- Inversion of a point
- Is the point on the curve?
The following curves are already implemented:
- secp224r1
- secp256r1
- secp384r1
- secp521r1
- brainpoolP160r1
- brainpoolP192r1
- brainpoolP224r1
- brainpoolP256r1
- brainpoolP320r1
- brainpoolP384r1
- brainpoolP512r1
It is also possible to define your own curve.
Installation
pip install PyECCArithmetic
Addition
from PyECCArithmetic import *
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
Subtraction
from PyECCArithmetic import *
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 new point
Multiplication
Multiplication is realised with the double and add algorithm.
from PyECCArithmetic import *
p = Point(x_1, y_1) # curve defaults to Curve.secp256r1()
z = p * 3 # z is a new point
Division
from PyECCArithmetic import *
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
Order calculation
from PyECCArithmetic import *
p = Point(x_1, y_1) # curve defaults to Curve.secp256r1()
order = p.calcOrder(timeout=5) # tries to calculate the order for maximal timeout seconds
Custom curve definition
from PyECCArithmetic import *
# Only curves defined as Weierstrass equation are supported
# y^2 = x^3 + a * x + b mod p
c = Curve(a, b, p, name='optional')
Is the point on the curve?
from PyECCArithmetic import *
onCurve = Point(1,1).isOnCurve # true or false
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file PyECCArithmetic-1.0.1.tar.gz.
File metadata
- Download URL: PyECCArithmetic-1.0.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7aecde92b0139ea25dec153da0e6835e30079210826db6300f5d044b0f716eb1
|
|
| MD5 |
6b43fa9edf46616c520f7b71d042d4a4
|
|
| BLAKE2b-256 |
891552ef32dc85d36c450fd079a69af30e98bc3a4beb807d17adc5acbc62bf2d
|
File details
Details for the file PyECCArithmetic-1.0.1-py3-none-any.whl.
File metadata
- Download URL: PyECCArithmetic-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1eaebd5f34c9d9d8f1fa17a53c53b78a40c8925ec9cf4e0319bb8073959f61b6
|
|
| MD5 |
d439253544d24ba5704e73c5734c090f
|
|
| BLAKE2b-256 |
7639ecf93d5bc45d70f77084d02e9eb8aba5acf73b61aebac55a67265c3dc7a1
|