roll

암호문의 순환

Engine.roll(ciphertext, roll_key, shift)
암호문을 지정된 shift 만큼 오른쪽으로 순환시켜서 반환합니다. [1, 2, 3, 4] 를 1만큼 순환시키면 [4, 1, 2, 3] 이 됩니다. 일반적으로 레벨을 소모하지 않습니다. 부트스트랩용으로 생성된 엔진이 아니면서 최대 레벨인 경우에만 레벨을 소모합니다.
  • 인풋:
    • Ciphertext
    • RollKey
    • shift: int
  • 아웃풋:
    • Ciphertext
from desilofhe import Engine

engine = Engine()
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
roll_key = engine.create_roll_key(secret_key)

message = [1, 2, 3]
ciphertext = engine.encrypt(message, public_key)
rolled_ciphertext = engine.roll(ciphertext, roll_key, shift=1)
Engine.roll(ciphertext, evaluation_key, shift)
연산 키에 포함된 순환 키를 사용하여, 암호문을 지정된 shift 만큼 오른쪽으로 순환시켜서 반환합니다. [1, 2, 3, 4] 를 1만큼 순환시키면 [4, 1, 2, 3] 이 됩니다. 일반적으로 레벨을 소모하지 않습니다. 부트스트랩용으로 생성된 엔진이 아니면서 최대 레벨인 경우에만 레벨을 소모합니다.
  • 인풋:
    • Ciphertext
    • EvaluationKey
    • shift: int
  • 아웃풋:
    • 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)
rolled_ciphertext = engine.roll(ciphertext, evaluation_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)