Skip to content

Commit b150c7e

Browse files
committed
add README.md and make pyproject.toml
1 parent 29a24c9 commit b150c7e

File tree

2 files changed

+188
-1
lines changed

2 files changed

+188
-1
lines changed

README.md

Lines changed: 134 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,134 @@
1-
## Elliptic Curve Cryptography in Python
1+
# ECC
2+
3+
[![PyPI version](https://badge.fury.io/py/eccrypto.svg)](https://pypi.org/project/eccrypto/)
4+
[![License](https://img.shields.io/github/license/drtoxic69/ECC)](./LICENSE)
5+
[![Downloads](https://img.shields.io/pypi/dm/eccrypto)](https://pypi.org/project/eccrypto/)
6+
[![Issues](https://img.shields.io/github/issues/drtoxic69/ECC)](https://github.com/drtoxic69/ECC/issues)
7+
8+
9+
A pure Python library for **Elliptic Curve Cryptography (ECC)** — built from scratch with clarity and educational readability in mind.
10+
Supports digital signatures (ECDSA), key generation, and secure field arithmetic over common curves like `secp256k1`, `P-256`, and more.
11+
12+
---
13+
14+
## ✨ Features
15+
- Finite field arithmetic over prime fields (`FieldElement`)
16+
- Curve definition (`Curve` and `Point`)
17+
- ECC point addition, doubling, and scalar multiplication
18+
- Key pair generation (`keys.py`)
19+
- ECDSA signature generation and verification (`ecdsa.py`)
20+
- Built-in support for popular curves (`secp256k1`, `P-256`, `brainpool`, etc.)
21+
- Easy-to-understand documentation in every module for educational purposes
22+
23+
---
24+
25+
## 📦 Installation
26+
27+
### From PyPI:
28+
```bash
29+
pip install eccrypto
30+
```
31+
32+
## 🔍 Quick Examples
33+
34+
### 🔑 Key Generation
35+
36+
```python
37+
from ecc import generate_keypair
38+
from ecc import secp256k1
39+
40+
priv, pub = generate_keypair(secp256k1)
41+
42+
print("Private Key:\n", priv)
43+
print("Public Key:\n", pub)
44+
```
45+
46+
### ✍️ ECDSA Sign & Verify
47+
48+
```python
49+
from ecc import secp256k1
50+
from ecc import generate_keypair
51+
from ecc import sign, verify
52+
53+
priv, pub = generate_keypair(secp256k1)
54+
55+
msg = b"Heyy! :D"
56+
signature = sign(msg, priv)
57+
print("Signature:", signature)
58+
59+
valid = verify(msg, signature, pub)
60+
61+
if valid:
62+
print("The signtature is valid!")
63+
```
64+
65+
### 📌 Curve and Point Usage
66+
67+
```python
68+
from ecc import Curve, Point
69+
70+
a, b = 2, 2 # Curve: y^2 = x^3 + 2x + 2
71+
72+
P = 17 # Prime modulus
73+
G = (5, 1) # Generator Point
74+
n = 19 # Number of points in E(Z/17Z)
75+
76+
curve = Curve(a, b, P, G, n)
77+
print(curve)
78+
79+
G = Point(5, 1, curve)
80+
print("Generator point: ", G)
81+
82+
P = 2 * G # Scalar Multiplication
83+
P1 = P + P # Point Addition
84+
85+
print("2G = ", P)
86+
print("2G + 2G = ", P1)
87+
```
88+
89+
### 🔢 Field Arithmetic
90+
91+
```python
92+
from ecc import FieldElement
93+
94+
a = FieldElement(7, 13)
95+
b = FieldElement(8, 13)
96+
97+
print("a + b =", a + b)
98+
print("a * b =", a * b)
99+
print("a ** -1 =", a ** -1) # Inverse of a
100+
```
101+
102+
---
103+
104+
## 🧪 Testing
105+
106+
You can run the test suite using pytest:
107+
108+
```bash
109+
pytest
110+
```
111+
112+
All tests are located in the `tests/` directory and cover field arithmetic, point operations, key generation, and ECDSA functionality.
113+
114+
---
115+
116+
## 🤝 Contributions Welcome
117+
118+
PRs for adding new curves, improving documentation, and optimizations are welcome. Please make sure all tests pass.
119+
120+
---
121+
122+
## 📄 License
123+
124+
Licensed under the GPL-3.0 License. See [LICENSE](./LICENSE).
125+
126+
---
127+
128+
## 📞 Contact
129+
130+
**Author:** Shivakumar
131+
**Email:** shivakumarjagadish12@gmail.com
132+
**GitHub:** [drtoxic69](https://github.com/drtoxic69)
133+
134+
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.

pyproject.toml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[project]
2+
name = "eccrypto"
3+
version = "0.1.1"
4+
description = "Pure Python library for Elliptic Curve Cryptography (ECC) — built from scratch with clarity and educational readability in mind"
5+
readme = "README.md"
6+
license = { text = "GPL-3.0" }
7+
authors = [
8+
{ name = "Shivakumar", email = "shivakumarjagadish12@gmail.com" }
9+
]
10+
requires-python = ">=3.10"
11+
dependencies = []
12+
keywords = [
13+
"cryptography",
14+
"elliptic-curve",
15+
"ecc",
16+
"ecdsa",
17+
"secp256k1",
18+
"digital-signatures",
19+
"crypto",
20+
"security"
21+
]
22+
classifiers = [
23+
"Development Status :: 5 - Production/Stable",
24+
"Intended Audience :: Developers",
25+
"Intended Audience :: Education",
26+
"Intended Audience :: Science/Research",
27+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
28+
"Operating System :: OS Independent",
29+
"Programming Language :: Python :: 3",
30+
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
33+
"Programming Language :: Python :: 3.13",
34+
"Topic :: Security :: Cryptography",
35+
"Topic :: Software Development :: Libraries :: Python Modules",
36+
"Topic :: Education",
37+
"Typing :: Typed"
38+
]
39+
40+
[project.urls]
41+
Homepage = "https://github.com/drtoxic69/ECC"
42+
Repository = "https://github.com/drtoxic69/ECC"
43+
Issues = "https://github.com/drtoxic69/ECC/issues"
44+
Documentation = "https://github.com/drtoxic69/ECC#readme"
45+
"Source Code" = "https://github.com/drtoxic69/ECC"
46+
"Bug Reports" = "https://github.com/drtoxic69/ECC/issues"
47+
Changelog = "https://github.com/drtoxic69/ECC/releases"
48+
49+
[build-system]
50+
requires = ["hatchling"]
51+
build-backend = "hatchling.build"
52+
53+
[tool.hatch.build.targets.wheel]
54+
packages = ["ecc"]

0 commit comments

Comments
 (0)