level_down

Engine.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:
    • Ciphertext
    • level
      • The level should be an integer greater or equal to 0.
  • Output:
    • Ciphertext
from desilofhe import Engine

engine = Engine()
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)

message = [1, 2, 3]
ciphertext = engine.encrypt(message, public_key)

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

print(leveled_down.level)  # 1
Engine.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:
    • Plaintext
    • level
      • The level should be an integer greater or equal to 0.
  • Output:
    • Ciphertext
from desilofhe import Engine

engine = Engine()
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)

message = [1, 2, 3]
plinatext = engine.encrypt(message, public_key)

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

print(leveled_down.level)  # 1