A Lightweight Digital Signature Algorithm Library for Python
Project description
LightDSA
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 
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("secret.txt")
dsa.export_keys("public.txt", public = True)
del dsa
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.
# restore the cryptosystem for signer side
signer_dsa = LightDSA(algorithm_name = "eddsa", key_file = "secret.txt")
message = "Hello, world!"
signature = signer_dsa.sign(message)
# 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lightdsa-0.0.2.tar.gz.
File metadata
- Download URL: lightdsa-0.0.2.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78fce418b6085f8864d642a3e564a2ffa7a40859e541fe9ea164e31a26e5d479
|
|
| MD5 |
43def63ee0be384ca7eb6d5f514898c4
|
|
| BLAKE2b-256 |
7353301dd3abd3dc857be3f1074bd3584f785ec542e5a9ee75a058c2f7ba09d0
|
File details
Details for the file lightdsa-0.0.2-py3-none-any.whl.
File metadata
- Download URL: lightdsa-0.0.2-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1c83191726ee9858bd69f16fc1e1857499e2c22f4332c510f017113f98e733c
|
|
| MD5 |
1e80df97405a4e0bc229f4c02eb510f2
|
|
| BLAKE2b-256 |
b20f7eb962e43373d5804efde0ae8454fa687ded9490b36eb02c9e56614a1ef7
|