roll
Ciphertext Roll
Engine.roll(ciphertext, roll_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 engine is not configured for bootstrapping and the ciphertext is at the maximum allowable level for a given parameter.
- Input:
- Ciphertext
- RollKey
- shift: int
- Output:
- 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)- Rolls the input ciphertext to the right by the specified shift value, using the roll key bundled in the evaluation key.
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 engine is not configured for bootstrapping and the ciphertext is at the maximum allowable level for a given parameter.
- Input:
- Ciphertext
- EvaluationKey
- shift: int
- Output:
- Ciphertext
Warning
- The matrix form does not yet support this operation.
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)
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].
- Input:
- Plaintext
- shift: int
- Output:
- Plaintext