[Paper Review] A General Purpose Transpiler for Fully Homomorphic Encryption
This paper presents a general-purpose transpiler that automatically converts high-level C++ code into equivalent fully homomorphic encryption (FHE)-compatible code using the TFHE library and Google's XLS intermediate representation. The transpiler enables secure computation on encrypted data without requiring cryptographic expertise, offering modular, debuggable, and extensible FHE code generation for diverse FHE schemes and programming languages.
Fully homomorphic encryption (FHE) is an encryption scheme which enables computation on encrypted data without revealing the underlying data. While there have been many advances in the field of FHE, developing programs using FHE still requires expertise in cryptography. In this white paper, we present a fully homomorphic encryption transpiler that allows developers to convert high-level code (e.g., C++) that works on unencrypted data into high-level code that operates on encrypted data. Thus, our transpiler makes transformations possible on encrypted data. Our transpiler builds on Google's open-source XLS SDK (https://github.com/google/xls) and uses an off-the-shelf FHE library, TFHE (https://tfhe.github.io/tfhe/), to perform low-level FHE operations. The transpiler design is modular, which means the underlying FHE library as well as the high-level input and output languages can vary. This modularity will help accelerate FHE research by providing an easy way to compare arbitrary programs in different FHE schemes side-by-side. We hope this lays the groundwork for eventual easy adoption of FHE by software developers. As a proof-of-concept, we are releasing an experimental transpiler (https://github.com/google/fully-homomorphic-encryption/tree/main/transpiler) as open-source software.
Motivation & Objective
- To reduce the barrier to FHE adoption by enabling developers without cryptography expertise to write programs that operate on encrypted data.
- To provide a modular, extensible framework that decouples high-level language input from underlying FHE libraries and schemes.
- To support debugging and optimization of FHE programs by generating high-level, human-readable FHE-C++ output.
- To accelerate FHE research by enabling side-by-side comparison of programs across different FHE schemes and optimizations.
- To bridge the gap between high-level programming and low-level FHE operations through a reusable, open-source transpilation pipeline.
Proposed method
- The transpiler uses Google’s XLS SDK to generate an expressive, intermediate representation (IR) that is independent of both the source language and FHE backend.
- It translates high-level C++ operations (e.g., SUM, MUL, DIV) into low-level Boolean gates, then maps them to TFHE-native operations via a translation layer.
- The system supports complex data types such as structs and classes by automatically generating corresponding FHE data encodings.
- The transpiled output is FHE-C++ code that can be compiled and executed with the TFHE library, enabling end-to-end homomorphic computation.
- The modular design allows plugging in alternative FHE libraries or high-level languages without rewriting the core pipeline.
- The transpiler includes a runtime interpreter for the FHE IR, enabling flexible execution strategies including multicore dispatch.
Experimental results
Research questions
- RQ1Can a general-purpose transpiler automate the translation of high-level C++ programs into secure, functional FHE code without requiring cryptographic expertise?
- RQ2How can intermediate representations like XLS enable interoperability between diverse FHE schemes and high-level programming languages?
- RQ3To what extent can the transpiled FHE code be optimized for performance, especially for arithmetic and control flow operations?
- RQ4Can the transpiler support complex data structures like classes and structs while preserving correctness under homomorphic evaluation?
- RQ5How does the modular design facilitate comparative evaluation of new FHE schemes and optimization techniques?
Key findings
- The transpiler successfully converts arbitrary C++ programs into equivalent FHE-C++ code using TFHE and XLS, demonstrating end-to-end homomorphic execution on encrypted data.
- The use of XLS as an intermediate representation enables language- and scheme-agnostic compilation, enhancing modularity and extensibility.
- The transpiled code supports high-level operations such as addition, multiplication, and division, not just low-level Boolean gates, improving usability and performance.
- The system generates debuggable, human-readable FHE-C++ output, which is a significant improvement over previous tools that produce only low-level circuit representations.
- The framework enables direct comparison of different FHE schemes and optimizations on the same high-level programs, accelerating research and evaluation.
- The transpiler lays the foundation for future optimizations such as programmable bootstrapping, native arithmetic, and SIMD-style batching to improve performance.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.