fhelium.engine.ckks_decryptor
CKKS decryption and bounded coefficient reconstruction.
CkksDecryptor
class View source
CkksDecryptor(*, config: CkksConfig, device: torch.device, rns_layout: RnsLayout, rns_runtime: RnsRuntime, montgomery_parameters: MontgomeryParameters, plaintext_codec: CkksPlaintextCodec, engine_id: str)Decrypt ciphertext phases to bounded approximate coefficients.
The component evaluates two- or three-component secret-key phases in RNS and reconstructs only a bounded trailing-Q class into binary64 coefficients for decoding. That reconstruction is not exact full-
decrypt
method
def decrypt(ciphertext: Ciphertext, secret_key: SecretKey) -> Plaintext: ...Decrypt into bounded binary64 coefficient reconstruction.
Secret-key evaluation first forms
as coefficient-domain canonical standard RNS. The direct decrypt path then reconstructs the centered class from the trailing one/two Q primes into finite torch.float64 [*batch, coefficient] on the engine device. This approximate_coefficients result is valid only for decoding; it is not exact full-
decrypt_message
method
def decrypt_message(ciphertext: Ciphertext, secret_key: SecretKey, *, is_real: bool=False): ...Decrypt and decode with the ciphertext's actual scale.
This composes decrypt's bounded approximate-coefficient reconstruction with [*batch, slot] with final extent is_real=True. It is approximate and does not provide an exact decrypt-to-encrypt representation round trip. Inputs are unchanged.