Documentation Index
Fetch the complete documentation index at: https://docs.privora.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Understanding Fully Homomorphic Encryption
Fully Homomorphic Encryption (FHE) allows computations on encrypted data without decrypting it. This page explains the fundamentals and how Privora uses FHE.What is Homomorphic Encryption?
Homomorphic encryption is a form of encryption that allows specific mathematical operations to be performed on ciphertexts, producing an encrypted result that, when decrypted, matches the result of operations performed on the plaintext.TFHE (Torus FHE)
Privora uses TFHE (Torus Fully Homomorphic Encryption), a modern FHE scheme with:- Fast Boolean and Integer Operations: Efficient arithmetic on encrypted integers
- Programmable Bootstrapping: Enables arbitrary operations through function evaluation
- Practical Performance: Fast enough for real-world applications
Supported Operations
Privora supports the following operations on encrypted data:Arithmetic Operations
| Operation | Method | Operator | Example |
|---|---|---|---|
| Addition | .add(&other) | &a + &b | let sum = a.add(&b)?; |
| Subtraction | .sub(&other) | &a - &b | let diff = a.sub(&b)?; |
| Multiplication | .mul(&other) | &a * &b | let prod = a.mul(&b)?; |
Comparison Operations
| Operation | Method | Returns |
|---|---|---|
| Greater or Equal | .ge(&other) | EncryptedBool |
| Greater Than | .gt(&other) | EncryptedBool |
| Less or Equal | .le(&other) | EncryptedBool |
| Less Than | .lt(&other) | EncryptedBool |
| Equal | .eq_enc(&other) | EncryptedBool |
Comparison operations are more expensive than arithmetic operations in FHE. See the optimization guide for best practices.
Min/Max Operations
Conditional Selection
Theselect operation is the FHE equivalent of an if-then-else:
Supported Integer Types
| Type | Rust Type | Range | Ciphertext Size |
|---|---|---|---|
| u8 | Encrypted<u8> | 0-255 | ~10KB |
| u32 | Encrypted<u32> | 0-4B | ~40KB |
| u64 | Encrypted<u64> | 0-18Q | ~80KB |
Performance Characteristics
FHE operations have different performance profiles:| Operation | Relative Cost | Notes |
|---|---|---|
| Addition | Low | Fast, use freely |
| Subtraction | Low | Same as addition |
| Multiplication | Medium | ~2-3x addition |
| Comparison | High | Requires bootstrapping |
| Min/Max | High | Built on comparison |
| Select | High | Built on comparison |
Optimization Tips
- Minimize comparisons: Each comparison is expensive; batch when possible
- Use smaller types:
u8operations are faster thanu64 - Avoid deep chains: FHE operations add noise; keep computation chains short
- Batch operations: Submit multiple operations in a single transaction
Ciphertext Properties
FHE ciphertexts have specific properties:| Property | Description |
|---|---|
| Deterministic | Same plaintext + key = same ciphertext |
| Large | 10KB-100KB depending on type |
| Noise | Operations add noise; too much = decryption failure |
| Type-bound | Cannot mix Encrypted<u8> with Encrypted<u64> |
Security Considerations
- 128-bit security: TFHE parameters provide ~128-bit security
- Key management: FHE public key is shared; private key is distributed via MPC
- No plaintext leakage: Programs never see plaintext during computation
- Verifiable computation: All FHE operations are deterministic and verifiable
Next Steps
Encrypted Types
Learn about the Privora type system
Program Development
Start building FHE programs