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

Warning

  • This function is intended for experts who want the best possible performance.
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.level_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.

Warning

  • This function is intended for experts who want the best possible performance.
  • Input:
    • Plaintext
    • level
      • The level should be an integer greater than or equal to 0.
  • Output:
    • Plaintext
from desilofhe import Engine

engine = Engine()

message = [1, 2, 3]
plaintext = engine.encode(message)

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

print(leveled_down.level)  # 1