Fully Homomorphic Encryption Playground Supporting FHE, Search Engine & Benchmarks
- BFV Scheme Implementation: Brakerski-Fan-Vercauteren homomorphic encryption
- Key Generation: Secure public/private key pair generation
- Homomorphic Operations: Addition and multiplication on encrypted data
- Noise Management: Gaussian noise for security
- Private Search: Search encrypted documents without revealing queries
- Term Indexing: Encrypted inverted index for efficient searches
- Score Ranking: Relevance scoring on encrypted data
- Multiple Parameter Sets: Compare different security levels
- Operation Timing: Measure encryption, decryption, and computation times
- Memory Usage: Monitor resource consumption
git clone https://github.com/WillKirkmanM/encryption
cd encryption
go run main.go
- Polynomial ring operations
- Modular arithmetic
- Noise budget management
- Key generation and management
- Document indexing with encryption
- Private information retrieval
- Homomorphic query processing
Parameter Set | Poly Degree | Security Level | Performance |
---|---|---|---|
Small | 1024 | ~80 bits | Fast |
Medium | 2048 | ~128 bits | Moderate |
Large | 4096 | ~256 bits | Slow |
- Private Database Queries: Search without revealing search terms
- Secure Computation: Arithmetic on encrypted financial data
- Privacy-Preserving Analytics: Statistics on encrypted datasets
// Implement different FHE schemes
type BGVContext struct { ... }
type CKKSContext struct { ... } // For approximate arithmetic
// Add your own encrypted computations
func (ctx *BFVContext) CustomOperation(ct1, ct2 *Ciphertext) (*Ciphertext, error) {
// Your homomorphic operation here
}
- Key Generation: Most expensive operation
- Multiplication: Increases noise, requires key switching
- Circuit Depth: Limited by noise budget
- Parallelisation: Many operations can be vectorized
For production use, consider integrating with:
- Microsoft SEAL (C++ with Go bindings)
- HElib (C++ library)
- PALISADE (C++ framework)
This playground demonstrates:
- Ring Learning With Errors (RLWE) problem
- Polynomial modular arithmetic
- Noise growth in homomorphic operations
- Trade-offs between security and performance