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 760 forks source link

Changing Plaintext Space from p^e1 to p^e2 #455

Open willarderic opened 2 years ago

willarderic commented 2 years ago

I would like to change the plaintext space from one exponent to another, in particular where e2 > e1. It was mentioned in another issue, and I saw a function called divideByP() in the code that reduces the plaintext space by a factor of p. Is there a way to increase the plaintext space by a factor of p, and if so what would the process for doing that be?

sajetan commented 2 years ago

As mentioned #280 you can use ctxt.hackPtxtSpace(p^e2), but you should take care of removing the noise in the higher-order digits before decrypting your ciphertext.