skillfed

lightphe

A Lightweight Partially Homomorphic Encryption Library for Python

lightphe v0.0.25 149.0K downloads/30d#11,010 on PyPI105
Permissive license Active released

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 lightphe

uv

uv add lightphe

poetry

poetry add lightphe

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

homomorphic encryption pythonpartially homomorphic encryption libraryencrypt and compute without decryptionpaillier rsa elgamal pythonelliptic curve encryption schemeslightweight cryptographic libraryadditive multiplicative homomorphic
homomorphic-encryptioncryptographyprivacy-preserving

More Cryptography packages