mod_raise
Engine.mod_raise(ciphertext, bootstrap_key)
- Executes the ModRaise function, which is an internal step in the bootstrapping algorithm. Although the output is a ciphertext, since the full bootstrapping algorithm requires further steps such as coefficient to slot, evaluate modulo, and slot to coefficient, the output ciphertext cannot be used as a generic ciphertext. The ciphertext is only valid after the full bootstrapping algorithm is run. Only use this function to implement a custom bootstrapping function. This function can only be used if the engine is initialized for bootstrapping.
- Input:
- Ciphertext: The values must be within the range [−1,1].
- BootstrapKey
- Output:
- Ciphertext: has 25 levels.
from desilofhe import Engine
engine = Engine(use_bootstrap=True)
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
bootstrap_key = engine.create_bootstrap_key(secret_key, stage_count=3)
message = [-1, 0, 1]
ciphertext = engine.encrypt(message, public_key, level=0)
mod_raised = engine.mod_raise(ciphertext, bootstrap_key)
Engine.mod_raise(ciphertext, small_bootstrap_key)
- Executes the ModRaise function, which is an internal step in the bootstrapping algorithm. Although the output is a ciphertext, since the full bootstrapping algorithm requires further steps such as coefficient to slot, evaluate modulo, and slot to coefficient, the output ciphertext cannot be used as a generic ciphertext. The ciphertext is only valid after the full bootstrapping algorithm is run. Only use this function to implement a custom bootstrapping function. This function can only be used if the engine is initialized for bootstrapping.
- Input:
- Ciphertext: The values must be within the range [−1,1].
- BootstrapKey
- Output:
- Ciphertext: has 25 levels.
from desilofhe import Engine
engine = Engine(use_bootstrap=True)
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
small_bootstrap_key = engine.create_small_bootstrap_key(secret_key)
message = [-1, 0, 1]
ciphertext = engine.encrypt(message, public_key, level=0)
mod_raised = engine.mod_raise(ciphertext, small_bootstrap_key)
Since a bootstrap key incorporates a small bootstrap key, the two functions above do the same calculation.