level_down

GLEngine.level_down(ciphertext, level)
Reduces the level of the given ciphertext to the target level. In any operation, the engine will automatically level down input ciphertexts if needed. This function is intended for experts who want the best possible performance.
  • Input:
    • GLCiphertext
    • level
      • The level should be an integer greater or equal to 0.
  • Output:
    • GLCiphertext
from desilofhe import GLEngine

engine = GLEngine()
shape = engine.shape
secret_key = engine.create_secret_key()

message = np.ones(shape, dtype=np.float64)
ciphertext = engine.encrypt(message1, secret_key)

leveled_down = engine.level_down(ciphertext, level=1)

print(leveled_down.level)  # 1
GLEngine.level_down(plaintext, level)
Reduces the level of the given plaintext to the target level. In any operation, the engine will automatically level down input plaintexts if needed. This function is intended for experts who want the best possible performance.
  • Input:
    • GLPlaintext
    • level
      • The level should be an integer greater or equal to 0.
  • Output:
    • GLCiphertext
from desilofhe import GLEngine

engine = GLEngine()

message = np.ones(shape, dtype=np.float64)
plaintext = engine.encode(message)

leveled_down = engine.level_down(plaintext, level=1)

print(leveled_down.level)  # 1