# ECC
[](https://pypi.org/project/eccrypto/)
[](./LICENSE)
[](https://pypi.org/project/eccrypto/)
[](https://github.com/drtoxic69/ECC/issues)
A pure Python library for **Elliptic Curve Cryptography (ECC)** โ built from scratch with clarity and educational readability in mind.
Supports digital signatures (ECDSA), key generation, and secure field arithmetic over common curves like `secp256k1`, `P-256`, and more.
---
## โจ Features
- Finite field arithmetic over prime fields (`FieldElement`)
- Curve definition (`Curve` and `Point`)
- ECC point addition, doubling, and scalar multiplication
- Key pair generation (`keys.py`)
- ECDSA signature generation and verification (`ecdsa.py`)
- Built-in support for popular curves (`secp256k1`, `P-256`, `brainpool`, etc.)
- Easy-to-understand documentation in every module for educational purposes
---
## ๐ฆ Installation
### From PyPI:
```bash
pip install eccrypto
```
## ๐ Quick Examples
### ๐ Key Generation
```python
from ecc import generate_keypair
from ecc import secp256k1
priv, pub = generate_keypair(secp256k1)
print("Private Key:\n", priv)
print("Public Key:\n", pub)
```
### โ๏ธ ECDSA Sign & Verify
```python
from ecc import secp256k1
from ecc import generate_keypair
from ecc import sign, verify
priv, pub = generate_keypair(secp256k1)
msg = b"Heyy! :D"
signature = sign(msg, priv)
print("Signature:", signature)
valid = verify(msg, signature, pub)
if valid:
print("The signtature is valid!")
```
### ๐ Curve and Point Usage
```python
from ecc import Curve, Point
a, b = 2, 2 # Curve: y^2 = x^3 + 2x + 2
P = 17 # Prime modulus
G = (5, 1) # Generator Point
n = 19 # Number of points in E(Z/17Z)
curve = Curve(a, b, P, G, n)
print(curve)
G = Point(5, 1, curve)
print("Generator point: ", G)
P = 2 * G # Scalar Multiplication
P1 = P + P # Point Addition
print("2G = ", P)
print("2G + 2G = ", P1)
```
### ๐ข Field Arithmetic
```python
from ecc import FieldElement
a = FieldElement(7, 13)
b = FieldElement(8, 13)
print("a + b =", a + b)
print("a * b =", a * b)
print("a ** -1 =", a ** -1) # Inverse of a
```
---
## ๐งช Testing
You can run the test suite using pytest:
```bash
pytest
```
All tests are located in the `tests/` directory and cover field arithmetic, point operations, key generation, and ECDSA functionality.
---
## ๐ค Contributions Welcome
PRs for adding new curves, improving documentation, and optimizations are welcome. Please make sure all tests pass.
---
## ๐ License
Licensed under the GPL-3.0 License. See [LICENSE](./LICENSE).
---
## ๐ Contact
**Author:** Shivakumar
**Email:** shivakumarjagadish12@gmail.com
**GitHub:** [drtoxic69](https://github.com/drtoxic69)
For questions, bug reports, or feature requests, please open an issue on the [GitHub repository](https://github.com/drtoxic69/ECC) or contact me directly via email.
Raw data
{
"_id": null,
"home_page": null,
"name": "eccrypto",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "crypto, cryptography, digital-signatures, ecc, ecdsa, elliptic-curve, secp256k1, security",
"author": null,
"author_email": "Shivakumar <shivakumarjagadish12@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/e7/16/7bd66d014ec9a068462ffd5f84a74f5f7cb9c828bd55b41f966e67ccf6d0/eccrypto-0.2.0.tar.gz",
"platform": null,
"description": "# ECC\n\n[](https://pypi.org/project/eccrypto/)\n[](./LICENSE)\n[](https://pypi.org/project/eccrypto/)\n[](https://github.com/drtoxic69/ECC/issues)\n\n\nA pure Python library for **Elliptic Curve Cryptography (ECC)** \u2014 built from scratch with clarity and educational readability in mind.\nSupports digital signatures (ECDSA), key generation, and secure field arithmetic over common curves like `secp256k1`, `P-256`, and more.\n\n---\n\n## \u2728 Features\n- Finite field arithmetic over prime fields (`FieldElement`)\n- Curve definition (`Curve` and `Point`)\n- ECC point addition, doubling, and scalar multiplication\n- Key pair generation (`keys.py`)\n- ECDSA signature generation and verification (`ecdsa.py`)\n- Built-in support for popular curves (`secp256k1`, `P-256`, `brainpool`, etc.)\n- Easy-to-understand documentation in every module for educational purposes\n\n---\n\n## \ud83d\udce6 Installation\n\n### From PyPI:\n```bash\npip install eccrypto\n```\n\n## \ud83d\udd0d Quick Examples\n\n### \ud83d\udd11 Key Generation\n\n```python\nfrom ecc import generate_keypair\nfrom ecc import secp256k1\n\npriv, pub = generate_keypair(secp256k1)\n\nprint(\"Private Key:\\n\", priv)\nprint(\"Public Key:\\n\", pub)\n```\n\n### \u270d\ufe0f ECDSA Sign & Verify\n\n```python\nfrom ecc import secp256k1\nfrom ecc import generate_keypair\nfrom ecc import sign, verify\n\npriv, pub = generate_keypair(secp256k1)\n\nmsg = b\"Heyy! :D\"\nsignature = sign(msg, priv)\nprint(\"Signature:\", signature)\n\nvalid = verify(msg, signature, pub)\n\nif valid:\n print(\"The signtature is valid!\")\n```\n\n### \ud83d\udccc Curve and Point Usage\n\n```python\nfrom ecc import Curve, Point\n\na, b = 2, 2 # Curve: y^2 = x^3 + 2x + 2\n\nP = 17 # Prime modulus\nG = (5, 1) # Generator Point\nn = 19 # Number of points in E(Z/17Z)\n\ncurve = Curve(a, b, P, G, n)\nprint(curve)\n\nG = Point(5, 1, curve)\nprint(\"Generator point: \", G)\n\nP = 2 * G # Scalar Multiplication\nP1 = P + P # Point Addition\n\nprint(\"2G = \", P)\nprint(\"2G + 2G = \", P1)\n```\n\n### \ud83d\udd22 Field Arithmetic\n\n```python\nfrom ecc import FieldElement\n\na = FieldElement(7, 13)\nb = FieldElement(8, 13)\n\nprint(\"a + b =\", a + b)\nprint(\"a * b =\", a * b)\nprint(\"a ** -1 =\", a ** -1) # Inverse of a\n```\n\n---\n\n## \ud83e\uddea Testing\n\nYou can run the test suite using pytest:\n\n```bash\npytest\n```\n\nAll tests are located in the `tests/` directory and cover field arithmetic, point operations, key generation, and ECDSA functionality.\n\n---\n\n## \ud83e\udd1d Contributions Welcome\n\nPRs for adding new curves, improving documentation, and optimizations are welcome. Please make sure all tests pass.\n\n---\n\n## \ud83d\udcc4 License\n\nLicensed under the GPL-3.0 License. See [LICENSE](./LICENSE).\n\n---\n\n## \ud83d\udcde Contact\n\n**Author:** Shivakumar\n**Email:** shivakumarjagadish12@gmail.com\n**GitHub:** [drtoxic69](https://github.com/drtoxic69)\n\nFor questions, bug reports, or feature requests, please open an issue on the [GitHub repository](https://github.com/drtoxic69/ECC) or contact me directly via email.\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "Pure Python library for Elliptic Curve Cryptography (ECC) \u2014 built from scratch with clarity and educational readability in mind",
"version": "0.2.0",
"project_urls": {
"Bug Reports": "https://github.com/drtoxic69/ECC/issues",
"Changelog": "https://github.com/drtoxic69/ECC/releases",
"Documentation": "https://github.com/drtoxic69/ECC#readme",
"Homepage": "https://github.com/drtoxic69/ECC",
"Issues": "https://github.com/drtoxic69/ECC/issues",
"Repository": "https://github.com/drtoxic69/ECC",
"Source Code": "https://github.com/drtoxic69/ECC"
},
"split_keywords": [
"crypto",
" cryptography",
" digital-signatures",
" ecc",
" ecdsa",
" elliptic-curve",
" secp256k1",
" security"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fa7ce67310f3d1827810e92453a28a78f4aa9a978f0705c9260504349059bf63",
"md5": "e7e4f4f7a0732b7d38c84e377ce40c03",
"sha256": "4e50615e287b02254c4d3f87e68d3ecff7842cbba542ea6adf77662842682bf5"
},
"downloads": -1,
"filename": "eccrypto-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e7e4f4f7a0732b7d38c84e377ce40c03",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 26575,
"upload_time": "2025-08-04T17:54:02",
"upload_time_iso_8601": "2025-08-04T17:54:02.821142Z",
"url": "https://files.pythonhosted.org/packages/fa/7c/e67310f3d1827810e92453a28a78f4aa9a978f0705c9260504349059bf63/eccrypto-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e7167bd66d014ec9a068462ffd5f84a74f5f7cb9c828bd55b41f966e67ccf6d0",
"md5": "2a0e98498a5ed55afa3f77c4a25dc1a9",
"sha256": "76f564c229382b15c96697f70d3ee7b4cf0b0d9ba605b2c291e7983c33a7030b"
},
"downloads": -1,
"filename": "eccrypto-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "2a0e98498a5ed55afa3f77c4a25dc1a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 47314,
"upload_time": "2025-08-04T17:54:03",
"upload_time_iso_8601": "2025-08-04T17:54:03.916740Z",
"url": "https://files.pythonhosted.org/packages/e7/16/7bd66d014ec9a068462ffd5f84a74f5f7cb9c828bd55b41f966e67ccf6d0/eccrypto-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-04 17:54:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "drtoxic69",
"github_project": "ECC",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "eccrypto"
}