eccrypto


Nameeccrypto JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryPure Python library for Elliptic Curve Cryptography (ECC) โ€” built from scratch with clarity and educational readability in mind
upload_time2025-08-02 19:17:05
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseGPL-3.0
keywords crypto cryptography digital-signatures ecc ecdsa elliptic-curve secp256k1 security
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ECC

[![PyPI version](https://badge.fury.io/py/eccrypto.svg)](https://pypi.org/project/eccrypto/)
[![License](https://img.shields.io/github/license/drtoxic69/ECC)](./LICENSE)
[![Downloads](https://img.shields.io/pypi/dm/eccrypto)](https://pypi.org/project/eccrypto/)
[![Issues](https://img.shields.io/github/issues/drtoxic69/ECC)](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/fb/bb/96fb594bc6d2a287c984e4847c900d1c01287b94abadd0023e7d15fc55da/eccrypto-0.1.2.tar.gz",
    "platform": null,
    "description": "# ECC\n\n[![PyPI version](https://badge.fury.io/py/eccrypto.svg)](https://pypi.org/project/eccrypto/)\n[![License](https://img.shields.io/github/license/drtoxic69/ECC)](./LICENSE)\n[![Downloads](https://img.shields.io/pypi/dm/eccrypto)](https://pypi.org/project/eccrypto/)\n[![Issues](https://img.shields.io/github/issues/drtoxic69/ECC)](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.1.2",
    "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": "99346325583229981a348b0e4b5042c55387741f6544b568a90369c8eba39856",
                "md5": "562bd6db61aea9498f140d4d4c9ae1f8",
                "sha256": "ac7b6f0150590c26c02849ede4dd08532f7d8d25874b26e9632f11abecf16707"
            },
            "downloads": -1,
            "filename": "eccrypto-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "562bd6db61aea9498f140d4d4c9ae1f8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 25325,
            "upload_time": "2025-08-02T19:17:03",
            "upload_time_iso_8601": "2025-08-02T19:17:03.190207Z",
            "url": "https://files.pythonhosted.org/packages/99/34/6325583229981a348b0e4b5042c55387741f6544b568a90369c8eba39856/eccrypto-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fbbb96fb594bc6d2a287c984e4847c900d1c01287b94abadd0023e7d15fc55da",
                "md5": "48890e5aa263c7d44b51f16ebe0aac3b",
                "sha256": "9f9a7dca378409a920f2d8d7b783f4cf54e7789b57ef43f6710c85edaa5336a9"
            },
            "downloads": -1,
            "filename": "eccrypto-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "48890e5aa263c7d44b51f16ebe0aac3b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 44363,
            "upload_time": "2025-08-02T19:17:05",
            "upload_time_iso_8601": "2025-08-02T19:17:05.475974Z",
            "url": "https://files.pythonhosted.org/packages/fb/bb/96fb594bc6d2a287c984e4847c900d1c01287b94abadd0023e7d15fc55da/eccrypto-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-02 19:17:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "drtoxic69",
    "github_project": "ECC",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "eccrypto"
}
        
Elapsed time: 2.06830s