Skip to main content

LightDSA

PyPI Downloads Stars Tests License

Blog YouTube Twitter

Patreon GitHub Sponsors Buy Me a Coffee

LightDSA is a lightweight digital signature algorithm library for Python. It is a hybrid library supporting Elliptic Curve Digital Signature Algorithm (ECDSA) and Edwards-Curve Digital Signature Algorithm (EdDSA), RSA and DSA.

Installation PyPI

The easiest way to install the LightDSA package is to install it from python package index (PyPI).

pip install lightdsa

Then you will be able to import the library and use its functionalities.

from lightdsa import LightDSA

Usage

Once you initialize a LightDSA object with a specific DSA algorithm, such as ECDSA, EdDSA, or RSA, it will generate the private and public keys for your cryptosystem.

# built a cryptosystem
dsa = LightDSA(algorithm_name = "eddsa") # or ecdsa, rsa

# export keys
dsa.export_keys("public.txt", public = True)

# sign a message
message = "Hello, world!"
signature = dsa.sign(message)

If you wish to use a pre-existing exported cryptosystem, you should specify the exported key file during initialization. This will allow you to sign messages using the private key and verify messages using the public key as

# restore the cryptosystem for the verifier side
verifier_dsa = LightDSA(algorithm_name = "eddsa", key_file = "public.txt")
verifier_dsa.verify(message, signature)

Elliptic Curve Forms and Pre-Defined Curves

LightDSA supports Weierstrass, Koblitz and Edwards forms and hundreds of pre-defined curves that can be adopted in ECDSA and EdDSA.

By default, ECDSA uses the Weierstrass form with the secp256k1 curve (the curve used by Bitcoin), while EdDSA uses the Edwards form with the ed25519 curve. However, you can switch the elliptic curve form and the specific curve for both ECDSA and EdDSA during the initialization of the LightDSA object. Meanwhile, the hashing algorithm is determined based on the order of the elliptic curve, which defines the number of points available over the finite field.

dsa = LightDSA(
    algorithm_name = "eddsa",
    form_name = "edwards",
    curve_name = "ed448"
)

See curves page for more details.

Contributing

All PRs are more than welcome! If you are planning to contribute a large patch, please create an issue first to get any upfront questions or design decisions out of the way first.

You should be able run make test and make lint commands successfully before committing. Once a PR is created, GitHub test workflow will be run automatically and unit test results will be available in GitHub actions before approval.

Support

There are many ways to support a project - starring⭐️ the GitHub repo is just one 🙏

You can also support this work on Patreon, GitHub Sponsors or Buy Me a Coffee.

Also, your company's logo will be shown on README on GitHub if you become sponsor in gold, silver or bronze tiers.

Citation

Please cite LightDSA in your publications if it helps your research. Here is its BibTex entry:

@misc{serengil2025lightdsa
    author       = {Serengil, Sefik Ilkin},
    title        = {LightDSA: A Lightweight Digital Signature Algorithm Library for Python},
    year         = {2025},
    publisher    = {GitHub},
    howpublished = {https://github.com/serengil/LightDSA},
}

License

LightDSA is licensed under the MIT License - see LICENSE for more details.

LightDSA logo is created by M. Ristiyanto and it is licensed under Creative Commons: By Attribution 3.0 License.

Metadata

Release files for lightdsa 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lightdsa 0.0.3
File Size Uploaded
lightdsa-0.0.3.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lightdsa 0.0.3
File Interpreter ABI Platform
lightdsa-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 30.3 kB

Release files / lightdsa-0.0.3.tar.gz

Download URL lightdsa-0.0.3.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d4544278fba1e220ad250dbe06c6cb0b4f2bf4430127ccc3080b4ebf353e2b6e
BLAKE2b-256 checksum
How to use checksums
31e9d54a2102150cb217bcd4d22b8961a807c988e16309212ffd856b9ec70dba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.31.0 requests-toolbelt/0.10.1 urllib3/1.26.15 tqdm/4.50.2 importlib-metadata/6.8.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

Release files / lightdsa-0.0.3-py3-none-any.whl

Download URL lightdsa-0.0.3-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea9e91586d8002ab205a2638983de72304370856332e986347492a7bf579a38b
BLAKE2b-256 checksum
How to use checksums
0a49ac1f258d4868bb8c8c4fbec7f9a69ffc755a525d25c4b0cf879717184cb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.31.0 requests-toolbelt/0.10.1 urllib3/1.26.15 tqdm/4.50.2 importlib-metadata/6.8.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page