commit b150c7e92fb3315c7ab95005759dbc82bda2bb8a
parent 29a24c989b14d7271594d66b48598de0d149cb25
Author: Shivakumar <[email protected]>
Date: Sun, 29 Jun 2025 16:46:29 +0530
add README.md and make pyproject.toml
Diffstat:
| M | README.md | | | 135 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- |
| A | pyproject.toml | | | 54 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 188 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
@@ -1 +1,134 @@
-## Elliptic Curve Cryptography in Python
+# 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:** [email protected]
+**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.
diff --git a/pyproject.toml b/pyproject.toml
@@ -0,0 +1,54 @@
+[project]
+name = "eccrypto"
+version = "0.1.1"
+description = "Pure Python library for Elliptic Curve Cryptography (ECC) โ built from scratch with clarity and educational readability in mind"
+readme = "README.md"
+license = { text = "GPL-3.0" }
+authors = [
+ { name = "Shivakumar", email = "[email protected]" }
+]
+requires-python = ">=3.10"
+dependencies = []
+keywords = [
+ "cryptography",
+ "elliptic-curve",
+ "ecc",
+ "ecdsa",
+ "secp256k1",
+ "digital-signatures",
+ "crypto",
+ "security"
+]
+classifiers = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "Intended Audience :: Education",
+ "Intended Audience :: Science/Research",
+ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
+ "Topic :: Security :: Cryptography",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ "Topic :: Education",
+ "Typing :: Typed"
+]
+
+[project.urls]
+Homepage = "https://github.com/drtoxic69/ECC"
+Repository = "https://github.com/drtoxic69/ECC"
+Issues = "https://github.com/drtoxic69/ECC/issues"
+Documentation = "https://github.com/drtoxic69/ECC#readme"
+"Source Code" = "https://github.com/drtoxic69/ECC"
+"Bug Reports" = "https://github.com/drtoxic69/ECC/issues"
+Changelog = "https://github.com/drtoxic69/ECC/releases"
+
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[tool.hatch.build.targets.wheel]
+packages = ["ecc"]