relinearize
Engine.relinearize(ciphertext, relinearization_key)- Relinearize a ciphertext from 3 polynomials (resulting from multiplication) back to 2 polynomials.
- Input:
- Ciphertext: Only applicable if the ciphertext has 3 polynomials due to multiplication.
- RelinearizationKey
- Output:
- 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)
message1 = [1, 2, 3]
ciphertext1 = engine.encrypt(message1, public_key)
message2 = [4, 5, 6]
ciphertext2 = engine.encrypt(message2, public_key)
multiplied = engine.multiply(ciphertext1, ciphertext2)
relinearized = engine.relinearize(multiplied, relinearization_key)
Engine.relinearize(ciphertext, evaluation_key)- Relinearize a ciphertext from 3 polynomials (resulting from multiplication) back to 2 polynomials, using the relinearization key bundled in the evaluation key.
- Input:
- Ciphertext: Only applicable if the ciphertext has 3 polynomials due to multiplication.
- EvaluationKey
- Output:
- Ciphertext
Warning
- The matrix form does not yet support this operation.
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)
message1 = [1, 2, 3]
ciphertext1 = engine.encrypt(message1, public_key)
message2 = [4, 5, 6]
ciphertext2 = engine.encrypt(message2, public_key)
multiplied = engine.multiply(ciphertext1, ciphertext2)
relinearized = engine.relinearize(multiplied, evaluation_key)