I am getting started with Homomorphic Encryption libraries. I am trying to port a codebase written in Python to Haskell. I see that there is a re-encryption operation happening in one part of the code. Something like this:
def re_encrypt(self, values): n = values.shape values = values.flatten() ret =  for i in range(n): pt = self.pri_key.decrypt(values[i]) ret.append(self.pub_key.encrypt(pt)) return np.array(ret)
Irrespective of the contents of
values, I see that the operation is simply decrypting and encrypting the same entity. In effect that's simply the identity function. I wonder why is this operation happening. One possibility that I considered is that this is simply a way to remove the noise. After several operations are carried out on the encrypted data, the noise becomes too high and then to remove it, decryption happens. Is that what is happening here?
For information, this Python library uses the Intel Paillier Crypto library. Thanks.