homenc / HElib

HElib is an open-source software library that implements homomorphic encryption. It supports the BGV scheme with bootstrapping and the Approximate Number CKKS scheme. HElib also includes optimizations for efficient homomorphic evaluation, focusing on effective use of ciphertext packing techniques and on the Gentry-Halevi-Smart optimizations.
https://homenc.github.io/HElib
Other
3.11k stars 761 forks source link

How to set gen, ords and mvec for bootstrapping (arbitrary primes)? #312

Open benjaminhmtan opened 5 years ago

benjaminhmtan commented 5 years ago

Your Contact: benjaminhmtan@gmail.com Your environment (OS/HW): Detailed Description:

I am looking to use bootstrapping but with parameters that are not in the table provided with HElib. From what I can tell, mvec should contain the divisors of m but probably in some order that I am not sure how to derive.

In one particular example, m=14383 = 19*757 and p=3, there is only one dimension in the slots, generator = 2 or order 756 and the degree of the extension field is 18. As far as I can tell, gens and ords should only contain the single elements {2} and {756}, but I tried the two possibilities for mvec both giving some kind of error.

mvec = {757, 19}
// 'helib::OutOfRangeError' what():  Generator at index i does not exists (Index out of range) and i is not -1 (Frobenius)
mvec = {19, 757} 
// 'helib::LogicError' what():  EvalMap: case not handled: bad inertPrefix
boev commented 5 years ago

I have experienced the same problem. My solution was to initialize the scheme with some m from the table and use the given values. The values in the table provide a wide-enough range of security and capacity for what I am doing. If you find a better solution please write something here. Have you successfully used bootstrapping? In my experience , it often leaves the result with less capacity than it initially had...or even eats it all up inducing decryption error. I have a feeling I am using it wrong.