c++encryptionseal

Perform Addition on a Product using the S.E.A.L. Library


I am trying to perform an operation that is of the form: (A * B) + C. The multiplication works fine, as all the numbers have the same scale at that point, but the product of A * B has a different scale than C. It makes sense that multiplication would change the scale, but I was wondering if there was a way to perform an operation like this using the SEAL library.

Environment information:

  1. Language: C++
  2. Encryption Scheme: CKKS
  3. Small encoded doubles (eg. 0.4531)
  4. Scale used for encoding: pow(2.0, 60) like the example

Thank you in advance and let me know if further information is needed.


Solution

  • There are multiple ways of getting this to work. For example, suppose ciphertexts A, B, C all have the same scale Z. Then A * B will have scale Z^2. At this point you should also relinearize A * B unless you have a strong reason not to.

    To compute A * B + C, you could for instance: