n1analytics / javallier

A Java library for Paillier partially homomorphic encryption.
Other
79 stars 22 forks source link

Better implementation of division operation #10

Closed mpnd closed 7 years ago

mpnd commented 8 years ago

Currently a / b (where a can be an EncryptedNumber, an EncodedNumber or a Number and b is either a long or a double) is computed as a * (1 / b). Is there a better way to calculate a / b without computing 1 / b?

wilko77 commented 8 years ago

I can't see an alternative for EncryptedNumber, as Paillier only supports multiplication and not division. For the other cases, there might be alternatives, but is that really an issue? You might be able to save one multiplication, but they are pretty cheap even for humongous numbers.