sign_bootstrap
Engine.sign_bootstrap(ciphertext, relinearization_key, conjugation_key, lossy_bootstrap_key)- This bootstrapping operation is a variant of the lossy bootstrap that enables bootstrapping of sign values, i.e., -1 and 1, with higher precision. It also effectively reduces the noise of sign values during bootstrapping, improving the efficiency and accuracy of comparison functions such as min and max. Using the lossy 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 sign values, i.e., -1 or 1. The level of the ciphertext must be at least the stage_count of the lossy bootstrap key
- RelinearizationKey
- ConjugationKey
- LossyBootstrapKey
- Output:
- Ciphertext: restored to a level of 16 - 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)
lossy_bootstrap_key = engine.create_lossy_bootstrap_key(
secret_key, stage_count=3
)
message = [-1, 1]
ciphertext = engine.encrypt(message, public_key, level=3)
bootstrapped = engine.sign_bootstrap(
ciphertext, relinearization_key, conjugation_key, lossy_bootstrap_key
)
Engine.sign_bootstrap(ciphertext, relinearization_key, conjugation_key, rotation_key, small_bootstrap_key, stage_count=3)- This bootstrapping operation is a variant of the lossy bootstrap that enables bootstrapping of sign values, i.e., -1 and 1, with higher precision. It also effectively reduces the noise of sign values during bootstrapping, improving the efficiency and accuracy of comparison functions such as min and max. Using the small bootstrap key requires less memory than using the lossy bootstrap key, but is slower. This function can only be used if the engine is initialized for bootstrapping. It bootstraps a sign message with high precision.
- Input:
- Ciphertext: The ciphertext to be bootstrapped. The values must be sign values, i.e., -1 or 1. The level of the ciphertext must be at least the stage_count input value.
- ConjugationKey
- RotationKey
- SmallBootstrapKey
- 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 values from 3 to 5 are supported. The larger the stage count, the faster the bootstrapping, but the lower level of the final result.
- Output:
- Ciphertext: restored to a level of 16 - 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)
small_bootstrap_key = engine.create_small_bootstrap_key(secret_key)
message = [-1, 1]
ciphertext_level_3 = engine.encrypt(message, public_key, level=3)
bootstrapped = engine.sign_bootstrap(
ciphertext_level_3,
relinearization_key,
conjugation_key,
rotation_key,
small_bootstrap_key,
)
ciphertext_level_5 = engine.encrypt(message, public_key, level=5)
bootstrapped_stage_count_5 = engine.sign_bootstrap(
ciphertext_level_5,
relinearization_key,
conjugation_key,
rotation_key,
small_bootstrap_key,
stage_count=5,
)
Stage Count
Stage counts of 3, 4, and 5 are supported by default. For sparse bootstrapping, the following values are supported.
| key_size | slot_count | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| medium | 1 | ✅ | ||||
| medium | 2 | ✅ | ||||
| medium | 3 | ✅ | ||||
| medium | 4 | ✅ | ✅ | |||
| medium | 5 | ✅ | ✅ | |||
| medium | 6 | ✅ | ||||
| medium | 7 | ✅ | ✅ | |||
| medium | 8 | ✅ | ✅ | |||
| medium | 9 | ✅ | ✅ | |||
| medium | 10 | ✅ | ✅ | ✅ | ||
| medium | 11 | ✅ | ✅ | |||
| medium | 12 | ✅ | ✅ | |||
| medium | 13 | ✅ | ✅ | ✅ | ||
| medium | 14 | ✅ | ✅ | ✅ | ||
| large | 3 | ✅ | ||||
| large | 4 | ✅ | ||||
| large | 5 | ✅ | ||||
| large | 6 | ✅ | ||||
| large | 7 | ✅ | ||||
| large | 8 | ✅ | ||||
| large | 9 | ✅ | ✅ | |||
| large | 10 | ✅ | ✅ | |||
| large | 11 | ✅ | ||||
| large | 12 | ✅ | ✅ | |||
| large | 13 | ✅ | ✅ | |||
| large | 14 | ✅ | ✅ |