roll_many
회전 키를 통한 회전
Engine.roll_batch(ciphertext, rotation_key, shifts)
- 암호문을 지정된 shifts 각각의 값만큼 오른쪽으로 회전시켜서 반환합니다.
[1, 2, 3, 4] 를 1만큼 회전시키면 [4, 1, 2, 3] 이 됩니다.
하나의 암호문을 여러번 회전해야하는 경우 roll 함수를 여러번 호출하는 것에 비해 효율적입니다.
일반적으로 레벨을 소모하지 않습니다.
다자간 연산이 아니면서 최대 레벨인 경우에만 레벨을 소모합니다.
- 인풋:
- Ciphertext
- RotationKey
- shifts: list of int
- 아웃풋:
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_ciphertexts = engine.roll_batch(ciphertext, rotation_key, shifts=[1, 2])