Fully Homomorphic Encryption framework for the Lux ecosystem.
Torus is a comprehensive FHE framework providing Python APIs, LLVM compilation, and multi-language support for encrypted computation.
| Language | Package | Status |
|---|---|---|
| Python | torus-py |
✅ Full |
| Go | luxfi/fhe |
✅ Full |
| Rust | torus-rs |
✅ Full |
| C/C++ | libtorus |
✅ Full |
| Node.js | @luxfi/torus |
✅ Full |
| Ruby | torus-rb |
🔄 Beta |
| Elixir | torus_ex |
🔄 Beta |
| Haskell | torus-hs |
🔄 Beta |
pip install torusnpm install @luxfi/torusimport "github.com/luxfi/fhe"[dependencies]
torus = { git = "https://github.com/luxfi/torus" }from torus import Compiler, encrypt, decrypt
@Compiler.circuit
def private_add(a, b):
return a + b
# Compile to FHE circuit
circuit = private_add.compile({"a": "encrypted", "b": "encrypted"})
# Encrypt inputs
enc_a = encrypt(5)
enc_b = encrypt(3)
# Compute on encrypted data
result = circuit(enc_a, enc_b)
# Decrypt result
print(decrypt(result)) # 8from torus.ml import FHEClassifier
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=1000)
model = FHEClassifier()
model.fit(X, y)
model.compile(X)
# Encrypted inference
enc_X = model.encrypt(X[:1])
enc_pred = model.predict(enc_X)
pred = model.decrypt(enc_pred)from torus.agents import PrivateAgent, EncryptedContext
agent = PrivateAgent(model="luxfi/zen-7b")
# Create encrypted context
ctx = EncryptedContext()
ctx.add_document("Secret plans...", encrypted=True)
# Agent operates on encrypted data
response = agent.run("Summarize the plans", context=ctx)- torus-ml - Machine Learning
- torus-ntt - NTT acceleration
- torus-fft - FFT acceleration
- fhe-compiler - LLVM compiler
- luxfi/fhe - Go FHE library
- luxfi/lattice - Lattice primitives
- luxfi/fhe-gpu - GPU acceleration
BSD 3-Clause Clear License