roll_many

Engine.roll_batch(ciphertext, rotation_key, shifts)
Rolls the input ciphertext to the right by the specified shift value. For example, rolling [1, 2, 3, 4] by 1 results in [4, 1, 2, 3]. When rolling the same ciphertext by multiple values of shift, this function is more efficient than calling the roll function several times. In general, does not consume any level. A level is consumed only if the operation is not a multiparty computation and the ciphertext is at the maximum allowable level for a given parameter.
  • Input:
    • Ciphertext
    • RotationKey
    • shifts: list of ints
  • Output:
    • list of 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_ciphertexts = engine.roll_batch(ciphertext, rotation_key, shifts=[1, 2])