SEAL icon indicating copy to clipboard operation
SEAL copied to clipboard

Less-than / Greater-than Comparisons

Open schummd opened this issue 1 year ago • 1 comments

It seems to be impossible to find a working solution for less-than / greater-than comparison for HE and SEAL does not seem to provide such functionality. Is there a working example exists anywhere using SEAL library that compares two ciphertexts? that is, produces something as simple as Enc(x1) < Enc(x2) ? true : false.

Related issues: #162, #397.

Papers considered: Ilia Iliashenko and Vincent Zucca, Faster homomorphic comparison operations for BGV and BFV Ayantika Chatterjee and Indranil Sengupta, Searching and Sorting of Fully Homomorphic Encrypted Data on Cloud Florian Bourse, Olivier Sanders, and Jacques Traore, Improved Secure Integer Comparison via Homomorphic Encryption Juan Garay, Berry Schoenmakers, and Jose Villegas, Practical and Secure Solutions for Integer Comparison

schummd avatar Oct 02 '24 08:10 schummd

There is no obvious definite best way to implement a comparison. How to do it depends greatly on the parameters and our error tolerance. Therefore, it seemed prudent to leave this out from the core library and instead leave it for higher-level code. There is no example showing this because it is a pain to do and in my personal opinion in almost all cases doesn't make sense due to low accuracy and high noise cost. So if you find yourself needing a comparison, I would recommend considering all kinds of other options first before trying to implement it.

kimlaine avatar Oct 05 '24 22:10 kimlaine