Comparison between two ciphertexts
Hello, I want to calculate the mean of encrypted integers, for this I calculated first their sum, I have to divide it by the number of integers (also encrypted). The problem is that the division is not implemented for the BFV scheme, so I thought of comparing the sum with the multiples of the number of integers. But the encryption is not injective ( presence of noise ), I don't know how to do it. Would you have some suggestions please ? Thank you. @kimlaine @WeiDaiWD @fionser
BFV or BGV scheme preserves modulo arithmetic. For example, if two ciphertexts encrypt 3 and 6 and the plaintext modulus is 8, then the sum will decrypt to 1 instead of 9. "How do you define "dividing 5 by 2" in modulo arithmetic?
Hello @WeiDaiWD , first of all I would like to thank you for your previous answer. Indeed, all the integers with which I work will be very lower than the modulo, so I made so that I do not obtain 9=1 mod 8 . As for division, let's say for example that I am modulo 1024, and I want to divide 80 by 10. So I will look for the closest multiple of 10 to 80, so in this case it will be 8, since 810 = 80 modulo 1024. The problem is that each time I have to compare enc(mult10) with enc(80) by varying mult. But I'm not sure either that the encryption of 80 and 810 give the same thing as long as the bfv encryption adds noise and therefore not injective. I don't want to decrypt and compare because I want to work only on encrypted data. To divide 5 by 2, I will look for the closest multiple of 2 to 5, in this case it will be 2 ( 22 =4 ), I will only need the integer part for the moment. The main problem is the comparison of equality between two ciphertexts ( do they encrypt the same thing ?). Many thanks.
You cannot know whether two ciphertexts encrypt the same value unless you perform decryption. Without decryption, you can at most compute a ciphertext that encrypts 1 or 0: 1 means equal and 0 means otherwise.
Hi guys, I am having some difficulties understanding this encrypted comparison still even reading those papers. I will appreciate it if you could help to understand it based on one example.
- Encrypted all data, For say, I have 5 numbers {5,10,15,20,25}
- Encrypted the range value, ENC_range(10)
- Upload encrypted data and range value to the server
- Server computes it and finds the range >=10 in this case
- Return the encrypted outputs whose range >=10 only to the client
For steps 4 and 5, I am confused about how the server performs the comparison over encrypted data and returns the >=10 value as output only (To me, I found Vectorize the data and then apply a broadcast operation on the range value to perform step 3). For step 4, I want the server return to me the larger value whose range >=10 only; the client just wants a larger value, not the smaller one, I do not find anything for that; what I understand the client might need to do some filtering here to get it but Is there a way around client does not have to do it. How do I perform a comparison on all data here using SEAL or FHE or HE, is there any scheme that can help to achieve this goal? Is there any code example or implementation available to look into to understand? [I found this issue is open and the problem related to mine, hence I posted my question here:)]
Thank you. @WeiDaiWD