roll
Ciphertext Roll
Engine.roll(ciphertext, rotation_key, shift)
- 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].
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
- shift: int
- Output:
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)
Plaintext Roll
Engine.roll(plaintext, shift)
- Rolls the input plaintext to the right by the specified shift value.
For example, rolling
[1, 2, 3, 4] by 1 results in [4, 1, 2, 3].
from desilofhe import Engine
engine = Engine()
message = [1, 2, 3]
plaintext = engine.encode(message)
rolled_plaintext = engine.roll(plaintext, shift=1)