IBM / fhe-toolkit-linux

IBM Fully Homomorphic Encryption Toolkit For Linux. This toolkit is a Linux based Docker container that demonstrates computing on encrypted data without decrypting it! The toolkit ships with two demos including a fully encrypted Machine Learning inference with a Neural Network and a Privacy-Preserving key-value search.
MIT License
1.43k stars 158 forks source link

DOC SPRINT - CKKS EXAMPLE - Can anyone give me an example about division of ciphertext with CKKS? #59

Open chengbao-0 opened 3 years ago

chengbao-0 commented 3 years ago

Feature description Can anyone give me an example about division of ciphertext with CKKS?

I have no idea how to realize it. I tried to use the inverse of multiplication, but I didn't succeed.

Thanks for your help.

odellerh commented 3 years ago

Hi chengbao-0, division between two ciphertexts is not trivial and would incur significant costs to approximate that division.

If you know the divisor, you can perform division by encoding 1/divisor as CKKS plaintext before performing a multByConstant on the ciphertext. Of course, this would leak the divisor.

chengbao-0 commented 3 years ago

Hi chengbao-0, division between two ciphertexts is not trivial and would incur significant costs to approximate that division.

If you know the divisor, you can perform division by encoding 1/divisor as CKKS plaintext before performing a multByConstant on the ciphertext. Of course, this would leak the divisor.

chengbao-0 commented 3 years ago

I think I understand what you mean. Thank you very much for your help although it's not the answer I want.

dowem commented 3 years ago

I am updating this title to help plan some sprints to provide better docs and examples

dowem commented 3 years ago

Hi Dov, I was hoping you or Udi could provide an example we could use to show how we intend for people to do CKKS division. We might even have an example already somewhere to show this. If there is not one in the examples from the most recent PR we merged, could we get one sometime this week? The question comes up a lot and this seems like a place where convenience API and a good, extremely small example, would help a lot.

dubek commented 3 years ago

Unfortunately AFAIK there's no "extremely small example" -- as mentioned above, division by ciphertext is not available in the CKKS scheme. If there's a limit range of known possible ciphertexts, then one could approximate division using a polynomial, and the evaluated the polynomial using normal multiplication and addition operations. We don't have a ready-made example for that. I also looked at the new HElib 2.0 CKKS tutorial and it doesn't include division.