Introduction
ComputeFHE is a powerful C++ library designed to simplify the development of applications using Fully Homomorphic Encryption (FHE). It acts as a high-level abstraction layer over OpenFHE's BinFHE, which is an open source implementation of TFHE (FHE over the Torus). It provides developers with a syntax that closely resembles standard C++ while maintaining complete data privacy through encrypted computation.
Key Features
- Intuitive Encrypted Types: Use computefhe::Einteger and computefhe::Efixedpoint just like standard
int or double.
- Arithmetic & Logic: Supports overloaded arithmetic and logic operators for seamless homomorphic execution.
- Oblivious Array Access: The computefhe::Evector container enables "Oblivious RAM" style indexing that allows accessing elements using encrypted indices.
- Encrypted Control Flow: Branch on encrypted results using the
Eif macro, that handles internal state management and multiplexing automatically.
- Execution Strategies: Choose between computefhe::ALUStandard for two-input logic or computefhe::ALUOptimized for utilizing FHE-friendly, multi-input gate performance.
Architecture Overview
The library is built on a modular architecture:
- Context Management: Managed by computefhe::ComputeFHE, which provides access to low-level OpenFHE APIs via computefhe::ComputeFHE::GetBinFHEContext and allows cryptographic key management.
- ALU Layer: An abstract interface (computefhe::BaseALU) that defines core capabilities for logic gates, arithmetic operations, and word-level manipulations on encrypted data.
- C++ Tools: Support for global C-style utility functions, such as computefhe::Init and computefhe::Finalize, to simplify the setup and teardown of the global cryptographic environment.
- Simulation: Provides high-speed functional simulation through computefhe::BaseALUSimulator, that enables the generation of gate and bootstrapping statistics for the underlying circuit without the computational cost of FHE.
Quick Start Example
using namespace computefhe;
using namespace std;
Init(CCPARAM_TOY, ALU_OPTIMIZED, true);
else {
}
return 0;
}
Primary management class and entry point for the ComputeFHE library.
void Finalize()
Shuts down the ComputeFHE environment and releases global resources.
#define Eif(cond)
Encrypted conditional branching macro (FHE-compatible "if").
Definition ConditionManager.h:47
Template class for fixed-size encrypted integers.
Definition Einteger.h:768
Proxy object for accessing and modifying elements in an Evector using encrypted indices.
Definition Evector.h:45
Security Parameters
Configuration is handled via the computefhe::CryptoContextParam enum (provided by OpenFHE).
- STD128/STD192/STD256: Defines the target security bit-level. Uses GINX (Gama-Izabachene-Nguyen-Xie) bootstrapping.
- STD128_3/STD192_3/STD256_3: Enables optimized FHE operations (required for computefhe::ALUOptimized). Uses GINX (Gama-Izabachene-Nguyen-Xie) bootstrapping.
- STD*_LMKCDEY: Uses the Lee-Micciancio-Kim-Choi-Deryabin-Eom-Yoo bootstrapping method for significantly faster performance in many scenarios.
Optimization Parameters
Computational efficiency and noise management are controlled via the computefhe::ALUType enum.
- ALU_STANDARD: Uses fundamental two-input logic gates for all operations. Recommended for debugging or when using parameter sets that do not support multi-input gates.
- ALU_OPTIMIZED: Implements arithmetic logic using specialized FHE kernels (such as MAJ and XOR3). This strategy significantly reduces the total number of bootstrapping operations required, which results in faster execution.
Basic Usage: Select the desired strategy during initialization via computefhe::Init. Note that ALU_OPTIMIZED requires a 3-input enabled security parameter (marked with _3).
Example Initializations:
Init(CCPARAM_STD128, ALU_STANDARD);
Init(CCPARAM_STD192_3, ALU_OPTIMIZED);
Init(CCPARAM_STD256_3_LMKCDEY, ALU_OPTIMIZED);
- See also
- computefhe::ComputeFHE for the main API.
-
computefhe::ConditionManager for details on encrypted branching.
-
computefhe::Evector for oblivious indexing.
Authors
- Faris Serdar Taşel <fst@cankaya.edu.tr>
- Efe Çiftci <efeciftci@cankaya.edu.tr>
Citations
If you use ComputeFHE in your research, please cite the following work:
Taşel, F. S., & Saran, A. N. (2025). Improved arithmetic efficiency in TFHE through gate-level optimizations. The Journal of Supercomputing, 81(18), 1633. https://doi.org/10.1007/s11227-025-08107-8