microsoft / SEAL

Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
https://www.microsoft.com/en-us/research/group/cryptography-research/
MIT License
3.62k stars 709 forks source link

Is multiplication available between ciphertexts with different slots' numbers? #593

Open macknight opened 1 year ago

macknight commented 1 year ago

Hi, Suppose we have two ciphertexts c1 and c2. c1 is generated based on param whose slots is 1024. c2 is generated based on param whose slots is 512. Then is multiplication available between c1 and c2? If not, can we shrink c1 to have 512 slots? If we can shrink, how to shrink? Any idea, steps or references? The only element I want to keep is the first element(value). BR

rickwebiii commented 1 year ago

You can't multiply 2 ciphertexts encrypted under different keys, much less different scheme parameters; they're fundamentally incompatible. What application are you trying to implement that needs such a thing and what would you expect the resulting plaintext to be?

macknight commented 1 year ago

You can't multiply 2 ciphertexts encrypted under different keys, much less different scheme parameters; they're fundamentally incompatible. What application are you trying to implement that needs such a thing and what would you expect the resulting plaintext to be?

Alright, then can the ciphertext shrink the slots number? I want to do the mask operation to get the value at some specific slot.

BR

rickwebiii commented 1 year ago

You can't change the number of SIMD lanes, as it's fixed to be the polynomial degree. If you want to mask e.g. the second slot, you can multiply by [0, 1, 0, ..., 0], which will give you [0, m_1, 0, ..., 0]. However, if you're trying to do a reduction of some kind (i.e. add all the slots together), there are more efficient ways to do this than masking.

Pro7ech commented 1 year ago

A ciphertext that encrypts a message of n slots in a ring degree of 2^{k+1}n is equivalent to a ciphertext that encrypts 2^{k} concatenations of this message but encoded as a message of 2^{k}n slots.