nucypher / nufhe

NuCypher fully homomorphic encryption (NuFHE) library implemented in Python
https://nufhe.readthedocs.io/en/latest/
GNU General Public License v3.0
441 stars 53 forks source link

shape of the keyswitch_key #17

Closed Stirling75 closed 5 years ago

Stirling75 commented 5 years ago

Hello. I want to ask about the shape of the Keyswitch_key defined in the nuFHE library.

In the paper(TFHE:Fast fully Homomorphic Encryption over the Torus), the keyswitching key is the encryption of the component of the 'cloud key(which is of the size 1024)' under the secret key we had(of the size 500).

When I saw the shape of the a, b of the keyswitching key in nuFHE, a had size of (1024, 8, 4, 500), and b had size of (1024, 8, 4) I can see that 8 was used instead of 16 for binary decomposition. But where did 4 came out from? Also, the component(cloud_key.keyswitch_key.lwe.a[0,0,0,:]) was all zero. Can I ask why?

fjarri commented 5 years ago

This question perhaps better suits the nufhe channel on NuCypher Discord.

Briefly, 4 is the decomposition base (that is, the number is decomposed into elements ranging from 0 to 3). The first row corresponds to decomposed value == 0, and all its elements are equal to 0 (it is not used in keyswitching anyway, and is only there to avoid +1 bugs).

Stirling75 commented 5 years ago

Thanks! Didn't know there was a NuCypher discord server..

Joined the server, and thanks for the information! :D really helped