Tools
FHE Demo
A tiny, educational homomorphic encryption demo using a toy Paillier scheme.
Educational only - not production crypto
Add two integers without revealing them
Your browser encrypts each value, a simulated server multiplies ciphertexts, and the browser decrypts the sum.
Ciphertext A
-
Ciphertext B
-
Server sum (ciphertext)
-
Client decrypted sum
-
Homomorphic addition: the server multiplies ciphertext A and ciphertext B modulo n^2 to produce the ciphertext of (A + B). The browser then decrypts that sum.
How the math works
- Encrypt: c = g^m * r^n mod n^2 (m is A or B, r is random so the same input encrypts differently each time).
- Combine: c_sum = c_a * c_b mod n^2 (this corresponds to m_a + m_b).
- Decrypt: m = L(c^lambda mod n^2) * mu mod n, where L(u) = (u - 1) / n.
Pick values and run the demo.
Toy key parameters
Random tiny primes and derived values used for the demo. These are intentionally small and not secure.
Prime p
-
Prime q
-
n = p × q
-
n^2
-
g
-
Lambda (lcm)
-
Mu (mod inverse)
-
Limitations
- Uses tiny primes and BigInt math for clarity, not security.
- Ciphertexts are much larger than plaintext inputs.
- Performance does not scale; real FHE is far heavier.
Security model (30 seconds)
This is a toy Paillier-style construction with tiny primes. It demonstrates homomorphic addition but provides no real security. No server-side secrets and no user tracking are used. Do not use it for production data.