n1analytics / javallier

A Java library for Paillier partially homomorphic encryption.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better implementation of division operation

mpnd opened this issue · comments

commented

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?

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.