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.14k stars 765 forks source link

When the bootstrap recryption should be called #382

Closed xueyumusic closed 4 years ago

xueyumusic commented 4 years ago

My tests show that after recryption the levels left could be run are less than the non-bootstrap, for example, when not using bootstrap it could continue run levels N, but if recrypting at some point it only continue run levels M<N, so when and what condition the recryption should be called. For example,

if (ctxt.shouldRecrypt()) {
    pk.recrypt(ctxt)
}

what shouldRecrypt method should we use? like leftLevels, some noisebounds etc...

shaih commented 4 years ago

Generally you should recrypt when the "homomorphic capacity" gets too low and you want to increase it.

Specifically, for plaintext space modulo 2 (p=2, r=1) you probably want to recrypt as soon as ctxt.bitCapacity() goes below 30 or so. If you use a larger plaintext space (p>2 and/or r>1) then you need to recrypt earlier, maybe when the capacity goes below 40.

xueyumusic commented 4 years ago

Thanks, @shaih