square

Engine.square(ciphertext, relinearization_key)
인자를 제곱한 암호문을 반환합니다. 레벨을 소모합니다.
  • 인풋:
    • Ciphertext
    • RelinearizationKey, optional
      • 재선형화키를 전달하면 재선형화 처리가 된 암호문을 반환합니다. 재선형화를 하지 않으면 추후에 연산에 제약이 발생하기 때문에 제곱과 같이 하는 것을 권장합니다.
  • 아웃풋:
    • 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)

squared = engine.square(ciphertext, relinearization_key)
Engine.square(ciphertext, evaluation_key)
인자를 제곱한 암호문을 반환합니다. 결과 암호문은 연산 키에 포함된 재선형화 키로 재선형화되어 반환됩니다. 레벨을 소모합니다.
  • 인풋:
    • Ciphertext
    • EvaluationKey, optional
      • 연산 키를 전달하면 재선형화 처리가 된 암호문을 반환합니다. 재선형화를 하지 않으면 추후에 연산에 제약이 발생하기 때문에 제곱과 같이 하는 것을 권장합니다.
  • 아웃풋:
    • 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)

squared = engine.square(ciphertext, evaluation_key)