bootstrap
Engine.bootstrap(ciphertext, evaluation_key)- Restores the level, which is the remaining number of multiplications you can do with a ciphertext, of a ciphertext. Using an evaluation key, you can bootstrap with a single key instead of providing the relinearization, conjugation, and bootstrap keys separately. This function can only be used if the engine is initialized for bootstrapping.
- Input:
- Ciphertext: The ciphertext to be bootstrapped. The values must be within the range [−1,1].
- EvaluationKey
- Output:
- Ciphertext: has 17 multiplicative levels.
Warning
- The matrix form does not yet support this operation.
from desilofhe import Engine
engine = Engine(bootstrap=True)
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
evaluation_key = engine.create_evaluation_key(secret_key)
message = [-1, 0, 1]
ciphertext = engine.encrypt(message, public_key, level=0)
bootstrapped = engine.bootstrap(ciphertext, evaluation_key)
Engine.bootstrap(ciphertext, relinearization_key, conjugation_key, bootstrap_key)- Restores the level, which is the remaining number of multiplications you can do with a ciphertext, of a ciphertext. Using the bootstrap key is faster but requires more memory than using the small bootstrap key. This function can only be used if the engine is initialized for bootstrapping.
- Input:
- Ciphertext: The ciphertext to be bootstrapped. The values must be within the range [−1,1].
- RelinearizationKey
- ConjugationKey
- BootstrapKey
- Output:
- Ciphertext: has 17 multiplicative levels.
Warning
- The matrix form does not yet support this operation.
from desilofhe import Engine
engine = Engine(bootstrap=True)
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
relinearization_key = engine.create_relinearization_key(secret_key)
conjugation_key = engine.create_conjugation_key(secret_key)
bootstrap_key = engine.create_bootstrap_key(secret_key)
message = [-1, 0, 1]
ciphertext = engine.encrypt(message, public_key, level=0)
bootstrapped = engine.bootstrap(
ciphertext, relinearization_key, conjugation_key, bootstrap_key
)
Engine.bootstrap(ciphertext, relinearization_key, conjugation_key, roll_key, small_bootstrap_key)- Restores the level, which is the remaining number of multiplications you can do with a ciphertext, of a ciphertext. Using the small bootstrap key requires less memory than using the bootstrap key, but is slower. This function can only be used if the engine is initialized for bootstrapping.
- Input:
- Ciphertext: The ciphertext to be bootstrapped. The values must be within the range [−1,1].
- RelinearizationKey
- ConjugationKey
- RollKey
- SmallBootstrapKey
- Output:
- Ciphertext: has 17 multiplicative levels.
Warning
- The matrix form does not yet support this operation.
from desilofhe import Engine
engine = Engine(bootstrap=True)
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
relinearization_key = engine.create_relinearization_key(secret_key)
conjugation_key = engine.create_conjugation_key(secret_key)
roll_key = engine.create_roll_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)
bootstrapped = engine.bootstrap(
ciphertext,
relinearization_key,
conjugation_key,
roll_key,
small_bootstrap_key,
)