SEAL icon indicating copy to clipboard operation
SEAL copied to clipboard

How to calculate Polynomial Multiplication?

Open ZJG0 opened this issue 2 years ago • 2 comments

a=2x^0+x+4x^6, b=5x^0+6x, a*b=10x^0+17x+6x^2+20x^6+36x^7, How to directly calculate the coefficient of a*b by the SEAL?

ZJG0 avatar Apr 16 '23 08:04 ZJG0

There is no direct way. You first have to encode the polynomials with the batchencoder. This way you will create a plaintext. Afterwards, you have to encrypt it with the encryptor.encrypt(-) function and you will get a ciphertext. Later on you have to use the multiplication function in the file evaluator.h such as evalutator.multiply_inplace(-). Finally, you just have to decrypt the result and decode it. For a better understading of this library I recommend you to look at the examples in /native/examples.

lnazabal001 avatar Apr 20 '23 08:04 lnazabal001

  • The poly degree N, and the modulo q together define the polynomial ring ZZ_q[X]/(X^N + 1)
  • We need q = 1 mod 2N for fast poly multiplication.
  • Then we can use seal/util/ntt.h to compute the poly mul ie., a * b = c mod (X^N + 1, q)

fionser avatar May 10 '23 13:05 fionser