roll_many
Fixed Roll Key-Based Roll
Engine.roll_many(ciphertext, fixed_roll_keys)- Rotates the input ciphertext to the right by the shift value specified in each of the fixed roll key respectively.
For example, rotating
[1, 2, 3, 4]by 1 results in[4, 1, 2, 3]. When rotating the same ciphertext by multiple values of shift, this function is more efficient than calling therollfunction several times. 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
- FixedRollKeys: list of FixedRollKey
- Output:
- list of Ciphertext
from desilofhe import Engine
engine = Engine()
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
fixed_roll_key_1 = engine.create_fixed_roll_key(secret_key, shift=1)
fixed_roll_key_2 = engine.create_fixed_roll_key(secret_key, shift=2)
message = [1, 2, 3]
ciphertext = engine.encrypt(message, public_key)
fixed_roll_keys = [fixed_roll_key_1, fixed_roll_key_2]
rolled_ciphertexts = engine.roll_many(ciphertext, fixed_roll_keys)
Roll Key-Based Roll
Engine.roll_many(ciphertext, roll_key, shifts)- Rotates the input ciphertext to the right by the specified shift value. For example, rotating
[1, 2, 3, 4]by 1 results in[4, 1, 2, 3]. When rotating the same ciphertext by multiple values of shift, this function is more efficient than calling therollfunction several times. 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
- 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)
roll_key = engine.create_roll_key(secret_key)
message = [1, 2, 3]
ciphertext = engine.encrypt(message, public_key)
rolled_ciphertexts = engine.roll_many(ciphertext, roll_key, shifts=[1, 2])
Evaluation Key-Based Roll
Engine.roll_many(ciphertext, evaluation_key, shifts)- Rotates the input ciphertext to the right by the specified shift value, using the roll key bundled in the evaluation key. For example, rotating
[1, 2, 3, 4]by 1 results in[4, 1, 2, 3]. When rotating the same ciphertext by multiple values of shift, this function is more efficient than calling therollfunction several times. 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
- shifts: list of ints
- Output:
- list of 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_ciphertexts = engine.roll_many(ciphertext, evaluation_key, shifts=[1, 2])