Skip to content
YUENIX-FHEContact
Preview documentation. The YUENIX-FHE 1.0 API is in development and names or signatures may change before release. Request an evaluation

Quick start

This example squares two encrypted numbers, bootstraps the result, and decrypts it. Key holder and evaluator run in one process here. Keys, roles and deployment shows how to split them.

import numpy as np
import yuenix
with yuenix.Context() as ctx:
plan = ctx.plan(yuenix.Profile.CKKS64)
keys = plan.generate_keys() # key holder: secret key stays here
ev = keys.evaluator() # evaluator: public evaluation keys only
x = keys.encrypt(np.array([0.125, -0.25]), level=plan.capabilities.input_level)
y = ev.bootstrap(x)
sq = ev.mul(y, y)
print(keys.decrypt(sq)[:2]) # ≈ [0.015625, 0.0625]
  1. The context selects the GPU, owns the CUDA stream and stores the last error message.
  2. The plan fixes the CKKS parameters, the bootstrapping circuit and the rotation set. See Plans and profiles.
  3. The keyset holds the secret key. The evaluator holds only evaluation keys.
  4. bootstrap refreshes the ciphertext’s levels so that the multiplication has room. See Bootstrapping.