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 desilofhe 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
)
Engine.evaluate_polynomial(ciphertext, coefficients, evaluation_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의 어레이
- EvaluationKey
- 아웃풋:
- Ciphertext
Warning
- 행렬 엔진은 이 연산을 아직 지원하지 않습니다.
from desilofhe import Engine
engine = Engine()
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
evaluation_key = engine.create_evaluation_key(secret_key)
message = [1, 2, 3]
ciphertext = engine.encrypt(message, public_key)
coefficients = [7, 8, 9]
polynomial = engine.evaluate_polynomial(
ciphertext, coefficients, evaluation_key
)