mirror of
https://github.com/mii443/FINAL.git
synced 2025-08-22 15:05:36 +00:00
834d9f2ab9419889c6b0642c9d9b85c4bd5d69d7
Several parts of the key generation were actually encrypting polynomials and integers into vector ciphertexts, thus, now they just call the new function enc_ngs. As a result, the key generation code is simpler to understand. Morevoer, future applications may want to generate vector ciphertexts, thus, the function enc_ngs is interesting on its own.
FINAL
Faster FHE instantiated with NTRU and LWE
The FINAL library contains the implementation of the fully homorphic encryption schemes presented in the paper "FINAL: Faster FHE instantiated with NTRU and LWE", by Charlotte Bonte (charlotte.bonte@intel.com), Ilia Iliashenko (ilia@esat.kuleuven.be), Jeongeun Park (Jeongeun.Park@esat.kuleuven.be), Hilder V. L. Pereira (HilderVitor.LimaPereira@esat.kuleuven.be), and Nigel P. Smart (nigel.smart@kuleuven.be).
It is distributed under the MIT license. Please, check the LICENSE file for more details.
Requirements
A C++ compiler, the NTL and FFTW 3 libraries.
Run the code
- Run
make
in the main repository folder. - Run the
test
program and check that all the homomorphic gates are computed correctly.
Usage
Use test.cpp
and Makefile
as reference points to create and compile your own program with FINAL.
Example
// Input bits
int b1 = 0;
int b2 = 1;
// LWE encryption base scheme
SchemeLWE s;
// LWE ciphertexts
Ctxt_LWE ct1, ct2, ct_or, ct_nand, ct_xor, ct_and, ct_not;
// Encryption of bits
s.encrypt(ct1, b1);
s.encrypt(ct2, b2);
// Computes AND
s.and_gate(ct_and, ct1, ct2);
assert(s.decrypt(ct_and) == 0);
// Computes NAND
s.nand_gate(ct_nand, ct1, ct2);
assert(s.decrypt(ct_nand) == 1);
// Computes OR
s.or_gate(ct_or, ct1, ct2);
assert(s.decrypt(ct_or) == 1);
// Computes XOR
s.xor_gate(ct_xor, ct1, ct2);
assert(s.decrypt(ct_xor) == 1);
// Computes NOT
s.not_gate(ct_not, ct1);
assert(s.decrypt(ct_not) == 1);
Languages
C++
98.9%
Makefile
1%
C
0.1%