BenchmarksStack RankingHICS (Free)
APIsPricingDocsWhite PaperTokenBlogAboutSecurity Demo
Log InGet API Key
Tutorial · 10 min read

Homomorphic Encryption in Python—
Compute on Encrypted Data Without Decrypting

Encrypt data, process it while encrypted, decrypt the result—all in Python. H33's FHE API handles the math. BFV, CKKS, and FHE-IQ auto-routing explained for developers, not cryptographers.

4
FHE Engines
38.5µs
Per Auth
2.17M
Auth/sec
Free
No Credit Card

Table of Contents

  1. What Is Fully Homomorphic Encryption?
  2. The H33 Approach: 4 Engines, 1 API
  3. Python Example: Encrypt, Compute, Decrypt
  4. H33-Compile: The @h33.compile Decorator
  5. Biometric Matching on Ciphertext
  6. AI-Blind: AI on Encrypted Data
  7. Production Performance
  8. HICS: Score Your Encryption Readiness
  9. What's Next

What Is Fully Homomorphic Encryption?

Fully homomorphic encryption (FHE) is the holy grail of cryptography. It lets you compute on encrypted data without ever decrypting it. You encrypt your data, send the ciphertext to a server, the server processes it—adds, multiplies, runs algorithms—and sends back an encrypted result. You decrypt the result and get the correct answer. The server never sees your plaintext data at any point during the computation. Not during processing, not in memory, not in logs, not ever.

This sounds impossible, but the math has been proven since Craig Gentry's breakthrough in 2009. The challenge has always been performance. Early FHE schemes were millions of times slower than plaintext computation. A single encrypted multiplication could take seconds. For 15 years, FHE was an academic curiosity—mathematically elegant, practically useless. Researchers published papers. Nobody shipped products.

That changed. Modern FHE schemes—BFV for exact integer arithmetic, CKKS for approximate floating-point, BGV for modular arithmetic—combined with hardware-aware implementations have collapsed the performance gap to the point where FHE is production-viable for real workloads. H33 runs 2.17 million FHE-based authentications per second on a single Graviton4 instance. 38.5 microseconds per auth. That's not a lab result. That's a sustained 120-second benchmark on production hardware. The gap between "encrypted" and "fast" has closed.

The H33 Approach: 4 Engines, 1 API

FHE isn't one algorithm. It's a family of schemes, each optimized for different types of computation. Choosing the wrong scheme for your workload doesn't just slow things down—it can make the computation impossible. A scheme designed for exact integers can't do floating-point arithmetic. A scheme optimized for SIMD batching wastes resources on single-value operations. H33 runs four FHE engines and routes your computation automatically.

H33-128
BFV · EXACT INTEGER

Exact integer arithmetic. Biometric matching, voting, counting. NIST Level 1.

H33-CKKS
CKKS · APPROXIMATE

Floating-point on ciphertext. ML inference, statistics, signal processing.

H33-256
BFV · LEVEL 5

Maximum security. Government, defense, long-term secrets. 256-bit PQ security.

FHE-IQ
AUTO-ROUTER

Analyzes your computation, picks the engine. You don't choose—it chooses for you.

FHE-IQ is the key innovation for developers. You describe what you want to compute, and FHE-IQ selects the optimal engine, parameter set, and batching strategy. It analyzes the computation's multiplicative depth, plaintext modulus requirements, and precision needs, then routes to the right engine. You write application code. H33 handles the cryptography.

Python Example: Encrypt, Compute, Decrypt

Let's encrypt two numbers, multiply them while encrypted, and decrypt the result. The server that performs the multiplication never sees either number or the product.

Python — Encrypt, multiply on ciphertext, decrypt
import requests

API = "https://api.h33.ai/v1/fhe"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

# Step 1: Encrypt two values
ct_a = requests.post(f"{API}/encrypt", headers=HEADERS,
    json={"value": 42, "scheme": "auto"}).json()["ciphertext_id"]

ct_b = requests.post(f"{API}/encrypt", headers=HEADERS,
    json={"value": 7, "scheme": "auto"}).json()["ciphertext_id"]

# Step 2: Multiply while encrypted — server never sees 42 or 7
ct_result = requests.post(f"{API}/multiply", headers=HEADERS,
    json={"a": ct_a, "b": ct_b}).json()["ciphertext_id"]

# Step 3: Decrypt the result
result = requests.post(f"{API}/decrypt", headers=HEADERS,
    json={"ciphertext_id": ct_result}).json()["value"]

print(f"Encrypted 42 * 7 = {result}")  # Output: 294

That's the entire flow. scheme: "auto" tells FHE-IQ to pick the engine. For integer multiplication, it selects BFV (H33-128). If you encrypted floating-point values, it would route to CKKS. If you specified scheme: "bfv" or scheme: "ckks", you'd bypass auto-routing and use that engine directly. The ciphertext IDs are opaque references to encrypted values stored on H33's infrastructure. The plaintext values never leave your machine—they're encrypted client-side before transmission.

Your data (plaintext)
Encrypt (client-side)
Compute (on ciphertext)
Decrypt (client-side)
Result (plaintext)

H33-Compile: The @h33.compile Decorator

The REST API works, but it's verbose for complex computations. H33-Compile lets you write normal Python functions and run them on encrypted data with a single decorator. You write Python. H33 compiles it to FHE circuits.

Python — H33-Compile decorator
import h33

@h33.compile
def credit_score(income, debt, payment_history):
    """Compute credit score on encrypted financial data."""
    debt_ratio = debt / income
    score = 850 - (debt_ratio * 300) + (payment_history * 50)
    return score

# Encrypt inputs — the function runs entirely on ciphertext
encrypted_income = h33.encrypt(85000)
encrypted_debt = h33.encrypt(12000)
encrypted_history = h33.encrypt(0.95)

# Execute on encrypted data — H33 never sees the values
encrypted_score = credit_score(encrypted_income, encrypted_debt, encrypted_history)

# Decrypt the result
print(f"Credit score: {h33.decrypt(encrypted_score)}")  # ~855

The @h33.compile decorator analyzes the function's computation graph—arithmetic operations, control flow, data dependencies—and compiles it to an FHE circuit. FHE-IQ selects the optimal scheme (CKKS in this case, because of the division and floating-point arithmetic). The function executes on ciphertext from start to finish. H33's servers compute the credit score without ever seeing the income, debt, or payment history. The bank gets a score. The customer's financial data stays encrypted.

Biometric Matching on Ciphertext

This is where FHE gets transformative. Traditional biometric authentication requires the server to see your biometric template—your fingerprint encoding, face embedding, iris scan. If the server is breached, your biometrics are exposed. Unlike passwords, you can't rotate your fingerprints.

With H33's FHE biometric matching, the server computes the similarity between your live scan and your enrolled template without decrypting either one. The biometric data stays encrypted during the entire comparison. The server outputs an encrypted match/no-match result.

Python — Encrypted biometric matching
import h33

# Enroll: encrypt the biometric template (128-dim vector)
template = [0.23, 0.87, 0.45, ...]  # 128 dimensions
enrolled = h33.fhe.enroll_biometric(template)
# Returns: encrypted template ID — server never sees the vector

# Verify: encrypt a live scan, compare on ciphertext
live_scan = [0.24, 0.86, 0.44, ...]  # New capture
result = h33.fhe.verify_biometric(enrolled, h33.encrypt(live_scan))

print(f"Match: {result['match']}")      # True/False
print(f"Latency: {result['latency_us']}µs")  # ~38.5µs

The inner product between the encrypted template and encrypted live scan is computed using BFV's SIMD batching—32 users per ciphertext, 128 dimensions per user, all packed into 4,096 polynomial slots. One ciphertext multiply computes 32 biometric comparisons simultaneously. The result is an encrypted similarity score that's decrypted only to produce a binary match/no-match decision. The server never sees the biometric. The server never sees the similarity score. The server sees nothing.

AI-Blind: Let AI Process Your Data Without Seeing It

FHE enables a new category of AI: models that process your data without observing it. We call this AI-Blind. The model runs inference on encrypted inputs and produces encrypted outputs. The model operator learns nothing about your data. You learn nothing about the model's weights (protecting IP). Both parties benefit.

Medical Diagnosis

Encrypt patient records. AI diagnoses on ciphertext. Hospital gets the diagnosis. AI vendor never sees the medical data. HIPAA compliance by construction.

Financial Analysis

Encrypt portfolio data. AI runs risk analysis on ciphertext. Hedge fund gets insights. AI vendor never sees positions or trades. SEC-safe data sharing.

Legal Discovery

Encrypt documents. AI searches for relevant clauses on ciphertext. Law firm gets results. AI vendor never reads privileged communications.

AI-Blind is not theoretical. H33-CKKS supports the approximate arithmetic that neural networks require. Linear layers, polynomial activations, and softmax approximations all work on CKKS ciphertext. The precision loss from CKKS approximation (~10-7) is well within the noise tolerance of modern neural networks. You can run encrypted inference on models up to several hundred million parameters with acceptable latency for batch processing. Real-time inference on encrypted data is viable for smaller models and specific layers of larger models.

Production Performance

This isn't academic FHE running in a research lab. These are production numbers from H33's Graviton4 infrastructure, independently benchmarked and reproducible.

38.5µs
Per authentication
2.17M
Auth/sec (sustained)
939µs
FHE batch (32 users)
<$0.01
Per 1,000 operations

The key to H33's performance: we don't use general-purpose FHE libraries. The BFV engine uses Montgomery NTT with Harvey lazy reduction, NEON-accelerated Galois operations, pre-NTT public keys, NTT-domain enrolled templates, and batch CBD sampling. Every hot-path operation has been profiled and optimized at the assembly level for ARM Graviton4 (192 vCPUs, 377 GiB RAM). The result: 939 microseconds to batch-process 32 biometric authentications with FHE encryption, inner product, and decryption.

For comparison, Microsoft SEAL (the most popular FHE library) processes a single BFV multiplication in ~2 milliseconds on an Intel server. H33 processes 32 multiplications in 939 microseconds on Graviton4. The performance difference isn't incremental—it's a different class of engineering. This is what makes FHE production-ready instead of a science project.

Score Your Encryption Readiness

HICS — H33 Infrastructure Compliance Score

How ready is your codebase for encrypted computation? HICS scans your code for plaintext processing of sensitive data—biometrics, PII, financial records, medical data—and identifies every location where FHE could replace plaintext computation. It scores your codebase on a 0–100 scale for encryption readiness and produces a migration plan with effort estimates.

The HICS evaluation is STARK-attested. The grade is zero-knowledge verified. Your code never leaves your environment.

Score Your Codebase's Encryption Readiness →

What's Next

You've seen FHE in action: encrypt data, compute on ciphertext, decrypt the result. Here's where to go deeper:

Start Computing on Encrypted Data

Get your free API key. 10,000 calls/month. No credit card. Your first FHE computation in under a minute.

Get Free API Key
API Documentation H33-Compile FHE Deep Dive

Build With Post-Quantum Security

Enterprise-grade FHE, ZKP, and post-quantum cryptography. One API call. Sub-millisecond latency.

Get Free API Key → Read the Docs
Free tier · 10,000 API calls/month · No credit card required
Verify It Yourself