ibarrond / Pyfhel

PYthon For Homomorphic Encryption Libraries, perform encrypted computations such as sum, mult, scalar product or matrix multiplication in Python, with NumPy compatibility. Uses SEAL/PALISADE as backends, implemented using Cython.
https://pyfhel.readthedocs.io/
Apache License 2.0
469 stars 78 forks source link

How to use Bootstrapping #136

Closed macknight closed 2 years ago

macknight commented 2 years ago

Hi, May I know if any implementation libs support the bootstrapping operations of CKKS or not? If yes, where could I find it and its demos or examples?

AlexanderViand commented 2 years ago

Lattigo seems to support (some version of) CKKS bootstrapping: https://github.com/tuneinsight/lattigo/blob/master/ckks/bootstrapping/bootstrap_test.go

OpenFHE (formerly "Pallisade") also appears to support it: https://github.com/openfheorg/openfhe-development/blob/main/src/pke/examples/advanced-ckks-bootstrapping.cpp

As far as I know, SEAL does not support CKKS bootstrapping at the moment. I'm unsure about HElib.

macknight commented 2 years ago

Lattigo seems to support (some version of) CKKS bootstrapping: https://github.com/tuneinsight/lattigo/blob/master/ckks/bootstrapping/bootstrap_test.go

OpenFHE (formerly "Pallisade") also appears to support it: https://github.com/openfheorg/openfhe-development/blob/main/src/pke/examples/advanced-ckks-bootstrapping.cpp

As far as I know, SEAL does not support CKKS bootstrapping at the moment. I'm unsure about HElib.

Thank you Alexander. Do you know why SEAL don't support this feature? Will it affect the use of SEAL if SEAL don't support this feature?

macknight commented 2 years ago

Hi, for encryption mechanism, there are two modes, block cipher and stream cipher. So for HE, or for different HE schemes (BFV, BGV, CKKS, etc.), which cipher mode do these schmes belong to, block or stream mode? I don't think I've seen any introduction to this one. Any blogs or papers about HE schemes' cipher mode?

AlexanderViand commented 2 years ago

Do you know why SEAL don't support this feature? Will it affect the use of SEAL if SEAL don't support this feature?

I think the reason it's not (yet) supported is because it's not all that useful in most applications. Reasonable parameters allow a lot of computation in CKKS before bootstrapping is necessary. So it probably won't make a difference for most applications, except really advanced state-of-the-art works.

AlexanderViand commented 2 years ago

Hi, for encryption mechanism, there are two modes, block cipher and stream cipher. So for HE, or for different HE schemes (BFV, BGV, CKKS, etc.), which cipher mode do these schmes belong to, block or stream mode? I don't think I've seen any introduction to this one. Any blogs or papers about HE schemes' cipher mode?

I think you're mixing up two completely different things here. Block and stream ciphers are concepts from symmetric cryptography (e.g., AES) and don't make much sense for asymmetric/public-key cryptography systems like FHE schemes.

There's a variety of "Introduction to FHE" videos out there, and there's also this blog that assumes very little prior knowledge: https://blog.nucypher.com/an-engineers-guide-to-fully-homomorphic-encryption/

macknight commented 2 years ago

OK, I got an idea just now, do you think another important reason is because most FHE schemes are leveled FHE thus when level becomes 0, the computation stops and bootstrapping is not need as a result?

macknight commented 2 years ago

Hi, for encryption mechanism, there are two modes, block cipher and stream cipher. So for HE, or for different HE schemes (BFV, BGV, CKKS, etc.), which cipher mode do these schmes belong to, block or stream mode? I don't think I've seen any introduction to this one. Any blogs or papers about HE schemes' cipher mode?

I think you're mixing up two completely different things here. Block and stream ciphers are concepts from symmetric cryptography (e.g., AES) and don't make much sense for asymmetric/public-key cryptography systems like FHE schemes.

There's a variety of "Introduction to FHE" videos out there, and there's also this blog that assumes very little prior knowledge: https://blog.nucypher.com/an-engineers-guide-to-fully-homomorphic-encryption/

Thank you for your reply, I'll rethink about it.

macknight commented 2 years ago

Reasonable parameters allow a lot of computation in CKKS before bootstrapping is necessary

"Reasonable parameters allow a lot of computation in CKKS before bootstrapping is necessary" So how do I know when I should stop computations in CKKS before bootstrapping is necessary?

AlexanderViand commented 2 years ago

So how do I know when I should stop computations in CKKS before bootstrapping is necessary?

As a rough rule, you should have as many levels as you have sequential multiplications (i.e. "multiplicative depth"). There are some tools out there can help you with running CKKS programs without manually specifying things like this. You might want to have a look at EVA for example.

macknight commented 2 years ago

So how do I know when I should stop computations in CKKS before bootstrapping is necessary?

As a rough rule, you should have as many levels as you have sequential multiplications (i.e. "multiplicative depth"). There are some tools out there can help you with running CKKS programs without manually specifying things like this. You might want to have a look at EVA for example.

Thank you, I'll have a look.