evaluate_polynomial
Engine.evaluate_polynomial(ciphertext, coefficients, relinearization_key)
- Evaluate a polynomial of input coefficients with input ciphertext.
It evaluate \(a_0 + a_1x^1 + a_2x^2 + \cdots + a_nx^n\) for given ciphertext \(x\) and given coefficients \([a_0, a_1, \dots, a_n]\).
- Input:
- Ciphertext
- coefficients: an array of int or double
- RelinearizationKey
- Output:
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
)