LightECC

0.0.5 · active · verified Thu Apr 16

LightECC is a lightweight Python library for Elliptic Curve Cryptography (ECC) arithmetic. It provides support for various elliptic curve forms, including Weierstrass, Koblitz, and Edwards, along with many pre-defined curves. The library simplifies fundamental ECC operations such as point addition, subtraction, scalar multiplication, and division. As of its current version 0.0.5, LightECC aims to make ECC operations accessible without requiring deep understanding of the underlying mathematical principles. The library appears to be actively maintained, with recent updates.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a LightECC object, retrieve the base point, and perform basic elliptic curve point arithmetic operations like addition, subtraction, and scalar multiplication. It also shows an example of point division, noting its computational complexity.

from lightecc import LightECC

# Initialize an elliptic curve (defaults to Weierstrass if no form_name is given)
ec = LightECC(form_name="edwards", curve_name="ed25519")

# Get the base point G of the curve
G = ec.G

# Perform point arithmetic
_2G = G + G
_3G = _2G + G
_5G = _3G + _2G
_10G = _5G + _5G
_9G = _10G - G

# Scalar multiplication
_20G = 20 * G
_50G = 50 * G

# Division (solves ECDLP - computationally intensive)
_25G = _50G / G

print(f"Base point G: {G}")
print(f"2G: {_2G}")
print(f"50G divided by G (25G): {_25G}")

view raw JSON →