# Hi-FHE **Repository Path**: openeuler/Hi-FHE ## Basic Information - **Project Name**: Hi-FHE - **Description**: 本项目已经迁移至 AtomGit || This project has been migrated to AtomGit || Linked: https://atomgit.com/openeuler/Hi-FHE - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 17 - **Forks**: 11 - **Created**: 2025-05-29 - **Last Updated**: 2026-03-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: sig-security-facility ## README # Hi-FHE Hi-FHE is an FHE-accelerated computing system based on the Kunpeng processor. This project implements the classic BFV, BGV, and CKKS fully homomorphic encryption algorithms on the domestic Kunpeng CPU chip. By integrating advanced acceleration schemes, the system significantly improves the operational efficiency of homomorphic operations and fully supports bootstrapping for both CKKS and BFV schemes. ### Fully Homomorphic Encryption (FHE) Fully Homomorphic Encryption (FHE) is a cryptographic technique that allows arbitrary computations to be performed directly on encrypted data. The decrypted result is identical to the result of performing the same computation on the plaintext. Its core value lies in achieving "data usability without visibility" – enabling users to outsource data processing without needing to trust a third party. This is particularly suitable for privacy-sensitive scenarios such as cloud computing, medical data sharing, and financial risk control. #### **CKKS** CKKS (Cheon-Kim-Kim-Song) is a homomorphic encryption scheme that supports approximate arithmetic on real or complex numbers $^{[1]}$. A key advantage of this scheme is its ability to perform approximate homomorphic operations on fixed-point decimal data. In CKKS, plaintext data is encoded into complex vectors and embedded into a polynomial ring via the inverse FFT for encryption. The encrypted data supports homomorphic addition and multiplication. The decrypted result approximates the outcome of the same operations performed on the plaintext, with errors primarily stemming from rounding during encoding and floating-point precision limitations. Therefore, CKKS is widely used in privacy-preserving machine learning, data analysis, and other scenarios requiring numerical computation with tolerance for minor errors. #### **BFV** BFV (Brakerski/Fan-Vercauteren) is a homomorphic encryption scheme based on the Ring Learning With Errors (Ring-LWE) assumption $^{[2]}$, representing a key implementation among second-generation fully homomorphic encryption schemes. The BFV scheme directly encrypts vectors of integers modulo a modulus, supporting exact homomorphic addition and multiplication on ciphertexts. Unlike CKKS, BFV preserves the properties of exact integer arithmetic, making it suitable for applications requiring precise computation, such as secure multi-party computation, electronic voting, and integer aggregation. The scheme controls noise growth during operations through a noise management mechanism, thereby supporting a limited number of sequential homomorphic multiplications. #### **BGV** The BGV (Brakerski-Gentry-Vaikuntanathan) scheme is another important leveled fully homomorphic encryption scheme $^{[3]}$ , also based on the Ring-LWE problem. Building upon the BV11 scheme, BGV introduces modulus switching technology, which effectively manages the rapid noise growth during homomorphic multiplication, enabling support for multi-level homomorphic operations. #### **Technical Details** * Key-Switching: Key-switching is a core operation in the CKKS scheme, accounting for over 70% of the computational time in ciphertext-ciphertext multiplication, ciphertext rotation, bootstrapping, and other fully homomorphic encryption-based computation tasks. In this project, the CKKS implementation adopts the latest third-generation key switching algorithm$^{[4]}$ to significantly improve the operational efficiency of ciphertext multiplication and related operations. * CKKS Bootstrapping: The CKKS scheme aims to increase the ciphertext modulus by performing four key operations on the ciphertext: ModRaise, CoeffToSlot $^{[5]}$, EvalMod$^{[6]}$ and SlotToCoeff. These steps refresh the noise while preserving the homomorphic properties of the ciphertext. * BFV Bootstrapping: The BFV bootstrapping scheme is fundamentally a noise-refreshing technique that re-encrypts the ciphertext, enabling decryption operations to be performed while the data remains encrypted. This allows subsequent computations to continue seamlessly. Its core mechanism involves using the private key to "reset" the noise in the current ciphertext—effectively restoring the ciphertext to its initial, controllable noise state while preserving the computation result. This enables unlimited-depth fully homomorphic computations$^{[7]}$ $^{[8]}$. ### **Dependency Installation** Supported Platforms:​​ Kunpeng 920 series CPUs, including models 7260, 5250, 5220, 3210, etc. 1. NTL (Number Theory Library) Dependencies: * GMP (GNU Multiple Precision Arithmetic Library) * C++ Compiler。 Version:11.5.1 Installation Steps: 1. tar -xvf ntl-11.5.1.tar.gz 2. cd ntl-11.5.1/src 3. ./configure NTL_GMP_LIP=on 4. make 5. sudo make install 2. GMP (GNU Multiple Precision Arithmetic Library) Dependencies: * C Compiler(e.g. GCC) * GNU Make:for Compiling and Installing GMP Version:6.2.1 Installation Steps: 1. tar -xf gmp-6.2.1.tar.xz 2. cd gmp-6.2.1 3. ./configure 4. make 5. sudo make install ### **Build & Test** * BFV Test Execution (in the BFV directory): * cd build * cmake .. * make -j * numactl -C0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 ./BFV * BGV Test Execution (in the BGV directory): * cd build * cmake .. * make -j * numactl -C0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 ./BGV * CKKS Test Execution (in the CKKS directory): * cd build * cmake .. * make -j * numactl -C0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 ./CKKS ### **References** [1] [Homomorphic Encryption for Arithmetic of Approximate Numbers](https://eprint.iacr.org/2016/421) [2] [An Improved RNS Variant of the BFV Homomorphic Encryption Scheme](https://eprint.iacr.org/2018/117) [3] [Fully Homomorphic Encryption without Bootstrapping](https://eprint.iacr.org/2011/277) [4] [Accelerating HE Operations from Key Decomposition Technique](https://eprint.iacr.org/2023/413) [5] [Efficient Bootstrapping for Approximate Homomorphic Encryption with Non-Sparse Keys](https://eprint.iacr.org/2020/1203) [6] [Improved Bootstrapping for Approximate Homomorphic Encryption](https://eprint.iacr.org/2018/1043) [7] [Homomorphic Lower Digits Removal and Improved FHE Bootstrapping](https://eprint.iacr.org/2018/067) [8] [Homomorphic polynomial evaluation using Galois structure and applications to BFV bootstrapping](https://eprint.iacr.org/2023/1304) ### Call for Contributions We welcome all contributions, including but not limited to: * Introducing new computational optimization methods; * Extending support for new processor instructions; * Contributing new FHE algorithms; * Reporting issues in this code repository. If you are interested in contributing to Hi-FHE, please follow the relevant [Open Source License](http://license.coscl.org.cn/MulanPSL2) ### Acknowledgments Subject to compliance with the [Open Source License](http://license.coscl.org.cn/MulanPSL2), the distribution of the project code is unrestricted. This project is supported by Huawei Technologies Co., Ltd. The views, opinions, and findings expressed are those of the authors and do not represent the official views or policies of Huawei Technologies Co., Ltd. We extend our gratitude to the technical teams, researchers, and academic members who have contributed to this project, including but not limited to: Peng Xu, Zhaojun Lu, Wei Wang, Yifan Yang, Jian Wu, Huikang Peng, Yanzhe Shen, Xingyu Guo, Qidong Chen, Zhiwei Yao, Lipeng Wan, Rui Zhang, etc.