Abstract
This paper investigates the extensibility of the OpenFHE library by implementing basic mathematical functions—such as division, logarithms, and square roots—within the CKKS cryptosystem. By overcoming the inherent limitations of Homomorphic Encryption (HE) regarding non-polynomial operations, the authors demonstrate the feasibility of complex workflows like the Box–Cox transformation for privacy-preserving data analysis.
Introduction: The Challenge of Non-Polynomial Operations
Homomorphic Encryption (HE) is often hailed as the "holy grail" of data privacy because it allows computers to process data while it remains encrypted. However, most HE schemes, including the popular CKKS cryptosystem, are mathematically restricted to addition and multiplication. In standard programming, calculating a square root or a division typically involves look-up tables or conditional branching (e.g., if-else statements). In the world of HE, these logical branches are impossible because the underlying data is hidden; the system cannot "know" if a value is positive or negative to decide a path.
This forces researchers to approximate complex functions using polynomials, a task that is both mathematically difficult and computationally expensive. This paper provides a systematic guide and implementation for these "missing" functions, making HE more accessible for complex data science tasks.
Methodology: Approximating the "Impossible"
The authors extended the OpenFHE library (v1.0.3) using the CKKS cryptosystem. Since standard logic was unavailable, they relied on iterative approximation algorithms and Taylor series expansions:
- Division and Square Root: These were implemented via the Newton–Raphson method. To avoid a "division-within-a-division" loop for square roots, the authors calculated $1/\sqrt{x}$ first and then multiplied by $x$.
- Exponential ($e^x$): The team utilized Taylor series approximations. To handle larger input ranges, they employed a scaling-and-squaring identity: $e^x = (e^{x/r})^r$.
- Logarithms: A modified Taylor series with a variable substitution trick was used to ensure the series converges over a wider range of inputs.
- Min/Max: To replace the
if(a > b)logic, they used the mathematical identity: $\max(a, b) = \frac{a+b}{2} + \frac{\sqrt{(a-b)^2}}{2}$.
A critical contribution of this work is the use of dynamic initialization. By employing a homomorphic linear approximation to find a "starting guess" for iterative methods, the authors significantly improved accuracy compared to using a fixed starting value.
Key Insights: Managing Multiplicative Depth
In HE, every multiplication increases the "noise" within the ciphertext. If the noise becomes too high, the data cannot be decrypted. The authors meticulously analyzed the "multiplicative depth" of each method, choosing algorithms that minimize depth even if they require more computational steps. As shown in the comparison between Newton-Raphson and Goldschmidt methods, the choice of algorithm directly impacts the depth requirements and the necessity of starting values.
Furthermore, for complex chains of operations like the Box–Cox transform, the authors utilized bootstrapping. This is a computationally heavy process that "refreshes" the ciphertext to prevent noise from overwhelming the signal, enabling deeper circuits than would otherwise be possible.
Results: Accuracy and Performance Benchmarks
The authors evaluated the functions using synthetic intervals (e.g., $[-100, 100]$ for division) and a real-world use case involving the New York birth figures dataset for a homomorphic Box–Cox transformation.
- Accuracy: Most functions achieved 95% accuracy within fewer than 10 iterations across tested ranges.
- Speed: Individual basic functions typically took about 10 seconds to compute on a reference server (HPE ProLiant with 2.6 GHz CPUs).
- The Box–Cox Milestone: The homomorphic Box–Cox transformation was successfully performed. While the plaintext version takes 3.4 milliseconds, the homomorphic version required 4.09 hours. Despite the significant latency, the mean deviation from the plaintext result was only 2.22%, proving the feasibility of high-security analytical tasks where real-time processing is not required.
Conclusion and Future Directions
The primary limitation remains latency; a four-hour transformation time is a high barrier for many applications. The authors suggest that transitioning from CPUs to GPUs or specialized hardware (FPGAs/ASICs) could drastically reduce these times. Future work will focus on automating the selection of intervals and precision to make the library more user-friendly for non-experts, with the ultimate goal of building privacy-preserving neural networks using these implemented activation functions.
Summary updated