lightphe
A Lightweight Partially Homomorphic Encryption Library for Python
What it is and what it does
LightPHE is a Python library that implements multiple partially and somewhat homomorphic encryption schemes—cryptographic systems that allow specific operations (addition, multiplication, or bitwise operations) to be performed directly on encrypted data without decryption. It supports algorithms including RSA (multiplicatively homomorphic), Paillier and Damgard-Jurik (additively homomorphic), and elliptic curve variants in Weierstrass, Edwards, and Koblitz forms.
The library is designed as a practical alternative to fully homomorphic encryption when your use case only requires limited operations on encrypted data. It trades off full generality for speed, smaller ciphertexts, smaller keys, and lower memory overhead—making it suitable for memory-constrained environments and cloud offloading scenarios where you encrypt locally, send ciphertexts to an untrusted server for computation, and decrypt results locally.
Use it for:
- Encrypt salary data locally, perform raises and bonuses as homomorphic addition in the cloud, decrypt results without revealing plaintext to the server
- Build encrypted analytics pipelines where aggregations happen on ciphertexts without exposing individual records
- Implement secure multi-party computation where parties exchange encrypted values and perform allowed operations without sharing private keys
- Prototype homomorphic encryption workflows before committing to slower fully homomorphic schemes
- Encrypt genomic or medical data and perform statistical operations on encrypted records for privacy-preserving research
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
LightPHE provides a Python library implementing partially and somewhat homomorphic encryption schemes including RSA, ElGamal, Paillier, and elliptic curve variants, allowing encrypted data to be computed on without decryption.
Yes, if you need a practical homomorphic encryption library for a specific use case (addition, multiplication, or bitwise operations) and want to avoid the performance cost of fully homomorphic encryption. The library is actively maintained, has no known vulnerabilities, low install friction, and permissive licensing. However, verify that the specific algorithm you need is production-ready and suitable for your security requirements before deploying to sensitive workloads.
Install
lightphe on PyPI
pip
pip install lightpheuv
uv add lightphepoetry
poetry add lightpheInstalling lightphe
Before you install
Low install friction with a pure Python wheel distribution. Actively maintained as of 2026-05-13 with recent releases. Depends on sympy, tqdm, and lightecc—all standard Python packages with no compiled dependencies.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute LightPHE freely in commercial and private projects with minimal restrictions.
Quickstart
pip install lightphe
from lightphe import LightPHE
cs = LightPHE(algorithm_name="Paillier")
m1 = 10000
c1 = cs.encrypt(m1)
c2 = cs.encrypt(500)
c3 = c1 + c2 # homomorphic addition
result = cs.decrypt(c3)
Verify before relying
- Whether the library has undergone formal cryptographic audit or security review
- Performance characteristics and practical key/ciphertext sizes for production workloads
- Whether all algorithms are production-ready or some are experimental
- Actual decryption result values for homomorphic operations in real usage
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.5.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — sympy, tqdm, lightecc |
| Maintenance | actively maintained — 94 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 148,980/month — #11,010 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lightphe-0.0.25-py3-none-any.whl
Tags
More Cryptography packages
Certifi provides Mozilla's curated collection…
copyleft · top 100 on PyPI
cryptographycryptography provides cryptographic recipes and…
permissive · top 100 on PyPI
rsaPure-Python RSA encryption, decryption,…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
azure-identityProvides Microsoft Entra ID token-based…
unclear · top 1,000 on PyPI
PyNaClPyNaCl provides Python bindings to libsodium…
permissive · top 1,000 on PyPI
lightdsaLightDSA provides digital signature generation…
permissive · top 15,000 on PyPI
lighteccLightECC provides elliptic curve arithmetic…
permissive · top 15,000 on PyPI
tensealTenSEAL performs homomorphic encryption…
permissive · top 15,000 on PyPI
eciespyEncrypts and decrypts data using Elliptic Curve…
permissive · top 15,000 on PyPI
gmsslPure-Python implementation of SM2, SM3, and SM4…
permissive · top 15,000 on PyPI
sslcryptoProvides AES, ECIES, and ECDSA cryptographic…
unclear · top 15,000 on PyPI
py-eccImplements elliptic curve cryptography…
permissive · top 5,000 on PyPI
PGPyPGPy implements OpenPGP (RFC 4880) in pure…
permissive · top 5,000 on PyPI
pycryptodomexPyCryptodomex provides low-level cryptographic…
permissive · top 1,000 on PyPI
py_arkworks_bls12381Python bindings for BLS12-381 elliptic curve…
permissive · top 15,000 on PyPI