# How can comparision like (>=,==) be done using homomorphic encryption?

Since we know that Homomorphic encryption allow computation on encrypted data. Let two n-bit integers $(x,y)$ are encrypted using some LWE public key cryptography. For example - if $x'= HEnc(x,pk)$ and $y'= HEnc(y,pk)$, Finding $Max(x',y')$ or $Min(x',y')$ or $Equal(x',y')$ the above comparison is necessary.

Now, we need to perform comparison (>=,==) operation homomorphically. How can we do this? Can anyone describe this with example?

• So both operands are encrypted and the result is an encrypted bit? Is that the scenario? Jan 26 '16 at 12:50
• Yes, this scenario is right. Homomorphic encryption allow computation on encrypted data. For example if x'=HEnc(x,pk) and y'=HEnc(y,pk), Finding Max(x',y') or Min(x',y') the above comparison is necessary. Jan 27 '16 at 4:21

You'll have to write the function you are trying to calculate as a polynomial in the two inputs $x$ and $y$. If you are working over the field with $q$ elements as plaintexts, you have to calculate for equality the polynomial $(x-y)^{q-1}$. Greater-than-or-equal (however you define that for finite fields) will be even more complicated.