evaluate_polynomial

Engine.evaluate_polynomial(ciphertext, coefficients, relinearization_key)
암호문을 이용하여 주어진 계수에 대응하는 다항식을 계산합니다. 암호문 \(x\)와 다항식 계수 \([a_0, a_1, \dots, a_n]\) 에 대해, \(a_0 + a_1x^1 + a_2x^2 + \cdots + a_nx^n\) 를 계산합니다.
  • 인풋:
    • Ciphertext
    • coefficients: int 혹은 double의 어레이
    • RelinearizationKey
  • 아웃풋:
    • Ciphertext
from liberate import Engine

engine = Engine()
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
relinearization_key = engine.create_relinearization_key(secret_key)

message = [1, 2, 3]
ciphertext = engine.encrypt(message, public_key)

coefficients = [7, 8, 9]
polynomial = engine.evaluate_polynomial(
    ciphertext, coefficients, relinearization_key
)