merge_bootstrap

Engine.merge_bootstrap(ciphertext1, ciphertext2, evaluation_key)
Merge bootstrap bootstraps two real number ciphertexts at once. 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:
    • ciphertext1: Ciphertext
      • The first ciphertext to be bootstrapped. It should contain only real numbers. The values must be within the range [−1,1].
    • ciphertext2: Ciphertext
      • The second ciphertext to be bootstrapped. It should contain only real numbers. The values must be within the range [−1,1].
    • EvaluationKey
  • Output:
    • (bootstrapped1, bootstrapped2) : tuple of Ciphertexts
      • A tuple of the bootstrapped ciphertexts. Each 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)

message1 = [-1, 0, 1]
message2 = [1, 0, -1]
ciphertext1 = engine.encrypt(message1, public_key, level=0)
ciphertext2 = engine.encrypt(message2, public_key, level=0)
bootstrapped1, bootstrapped2 = engine.merge_bootstrap(
    ciphertext1, ciphertext2, evaluation_key
)
Engine.merge_bootstrap(ciphertext1, ciphertext2, relinearization_key, conjugation_key, bootstrap_key)
Merge bootstrap bootstraps two real number ciphertexts at once. 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:
    • ciphertext1: Ciphertext
      • The first ciphertext to be bootstrapped. It should contain only real numbers. The values must be within the range [−1,1].
    • ciphertext2: Ciphertext
      • The second ciphertext to be bootstrapped. It should contain only real numbers. The values must be within the range [−1,1].
    • RelinearizationKey
    • ConjugationKey
    • BootstrapKey
  • Output:
    • (bootstrapped1, bootstrapped2) : tuple of Ciphertexts
      • A tuple of the bootstrapped ciphertexts. Each 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)

message1 = [-1, 0, 1]
message2 = [1, 0, -1]
ciphertext1 = engine.encrypt(message1, public_key, level=0)
ciphertext2 = engine.encrypt(message2, public_key, level=0)
bootstrapped1, bootstrapped2 = engine.merge_bootstrap(
    ciphertext1,
    ciphertext2,
    relinearization_key,
    conjugation_key,
    bootstrap_key,
)
Engine.merge_bootstrap(ciphertext1, ciphertext2, relinearization_key, conjugation_key, roll_key, small_bootstrap_key)
Merge bootstrap enables bootstrapping two real number ciphertexts at once. 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:
    • ciphertext1: Ciphertext
      • The first ciphertext to be bootstrapped. It should contain only real numbers. The values must be within the range [−1,1].
    • ciphertext2: Ciphertext
      • The second ciphertext to be bootstrapped. It should contain only real numbers. The values must be within the range [−1,1].
    • RelinearizationKey
    • ConjugationKey
    • RollKey
    • SmallBootstrapKey
  • Output:
    • (bootstrapped1, bootstrapped2) : tuple of Ciphertexts
      • A tuple of the bootstrapped ciphertexts. Each 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)

message1 = [-1, 0, 1]
message2 = [1, 0, -1]
ciphertext1 = engine.encrypt(message1, public_key, level=0)
ciphertext2 = engine.encrypt(message2, public_key, level=0)
bootstrapped1, bootstrapped2 = engine.merge_bootstrap(
    ciphertext1,
    ciphertext2,
    relinearization_key,
    conjugation_key,
    roll_key,
    small_bootstrap_key,
)