bootstrap

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 BootstrapKey is faster but requires more memory than using the RotationKey. 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: restored to a level of 10 in default. Level of a ciphertext differs according to stage_count.
from desilofhe import Engine

engine = Engine(use_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, stage_count=3)

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, rotation_key, stage_count)
Restores the level, which is the remaining number of multiplications you can do with a ciphertext, of a ciphertext. Using the RotationKey requires less memory than using the BootstrapKey, 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].
    • ConjugationKey
    • RotationKey
    • stage_count: optional
      • Specifies the number of levels used in coefficient to the slot function and the slot to coefficient function of bootstrapping algorithm. The default value is 3, and recommended values are from 3 to 5. The larger the stage count, the faster the bootstrapping, but the lower level of the final result.
  • Output:
    • Ciphertext: restored to a level of 10 in default. Level of a ciphertext differs according to stage_count.
from desilofhe import Engine

engine = Engine(use_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)
rotation_key = engine.create_rotation_key(secret_key)

message = [-1, 0, 1]
ciphertext = engine.encrypt(message, public_key, level=0)
bootstrapped = engine.bootstrap(ciphertext, relinearization_key, conjugation_key, rotation_key)

bootstrapped_stage_count_5 = engine.bootstrap(ciphertext, relinearization_key, conjugation_key, rotation_key, stage_count=5)