roll

암호문의 회전

Engine.roll(ciphertext, rotation_key, shift)
암호문을 지정된 shift 만큼 오른쪽으로 회전시켜서 반환합니다. [1, 2, 3, 4] 를 1만큼 회전시키면 [4, 1, 2, 3] 이 됩니다. 일반적으로 레벨을 소모하지 않습니다. 다자간 연산이 아니면서 최대 레벨인 경우에만 레벨을 소모합니다.
  • 인풋:
    • Ciphertext
    • RotationKey
    • shift: int
  • 아웃풋:
    • Ciphertext
from desilofhe import Engine

engine = Engine()
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
rotation_key = engine.create_rotation_key(secret_key)

message = [1, 2, 3]
ciphertext = engine.encrypt(message, public_key)
rolled_ciphertext = engine.roll(ciphertext, rotation_key, shift=1)

인코딩된 평문의 회전

Engine.roll(plaintext, shift)
인코딩된 평문을 지정된 shift 만큼 오른쪽으로 회전시켜서 반환합니다. [1, 2, 3, 4] 를 1만큼 회전시키면 [4, 1, 2, 3] 이 됩니다.
  • 인풋:
    • Plaintext
    • shift: int
  • 아웃풋:
    • Plaintext
from desilofhe import Engine

engine = Engine()

message = [1, 2, 3]
plaintext = engine.encode(message)
rolled_plaintext = engine.roll(plaintext, shift=1)