Expand description
§poulpy-ckks
Backend-agnostic implementation of the CKKS (Cheon-Kim-Kim-Song)
homomorphic encryption scheme, built on top of the low-level primitives
provided by poulpy-core, poulpy-hal, and the available compute
backends (poulpy-cpu-ref, poulpy-cpu-avx).
The crate uses a bivariate polynomial representation over the Torus
(base-2^{base2k} digits) instead of the RNS representation used by
most other CKKS libraries. Public precision management is exposed through
CKKSMeta:
log_delta: base-2 logarithm of the encoded plaintext scaling factorlog_budget: remaining homomorphic headroom, also tracked in bits
CKKSMeta also records the SlotsKind of a value: whether its slots are
known to be real, or may carry an imaginary part. Operations compose that
claim, keeping Real only when every operand is real, so a caller can state
it once at encoding time and have the pipelines specialize on it.
Together they define the semantic torus width of a value:
k() = log_delta + log_budget.
Storage is rounded up to the next multiple of base2k, so the allocated
capacity max_k() may exceed the effective width k(). Arithmetic APIs
update this metadata for you; buffers always stay at their allocated
width, and allocating a destination at exactly the k you want is how
results are narrowed.
Safe add/sub operations return K-normalized ciphertexts. Their
unnormalized variants live on api::CKKSAddOps and api::CKKSSubOps
and write into an layouts::UnnormalizedCKKSCiphertext for callers who
want to fuse several linear steps before normalizing explicitly. Limb
digits in that wrapper may hold un-propagated carries (wider than base2k
bits), so passing it to any DFT-domain primitive (keyswitching,
convolution, automorphisms) would produce incorrect decryptions. The
wrapper does not implement GLWEToBackendRef or GLWEToBackendMut,
making such misuse a compile error. Call
layouts::UnnormalizedCKKSCiphertext::normalize before the next
keyswitching or convolution step.
§Modules
| Module | Role |
|---|---|
approximation | Reusable minimax fitting, precision/depth selection, composite sign generation, and prepared interval-mapped polynomial evaluation |
encoding | CKKS encoders/decoders, including slot-wise real/imaginary packing |
layouts | CKKS ciphertext/plaintext wrappers and metadata-aware allocation helpers |
presets | Ready-to-use parameter sets |
api | The public op traits: leveled arithmetic (add, sub, mul, neg, rotate, conjugate), encryption, decryption, rescale, and scratch sizing |
api::CKKSBootstrappingOps | The CKKS bootstrapping pipeline: its one native primitive ModUp (modulus raise), plus CoeffsToSlots / SlotsToCoeffs and EvalMod re-exported as supertraits (api::CKKSDFTOps / api::CKKSEvalModOps); parameterized by layouts::BootstrappingPlan |
api::CKKSPaCoOps | PaCo bootstrapping without ModUp or EvalMod; parameterized by layouts::PaCoPlan and a compiled layouts::PaCoContext |
Re-exports§
pub use scalar::Quad;
Modules§
- api
- approximation
- Reusable host-side polynomial approximation planning.
- default
- encoding
- Backend-independent CKKS encoding algorithms.
- layouts
- CKKS-level data structures.
- oep
- Backend override seams: one
unsafe trait CKKS*Impl<BE>per op family. - polynomial
- power_
basis - prelude
- One-stop imports for the common CKKS path.
- presets
- Ready-to-use CKKS parameter sets.
- scalar
- Portable quad-precision (IEEE 754 binary128) scalar for high-precision CKKS.
Macros§
- impl_
ckks_ add_ defaults - impl_
ckks_ conjugate_ defaults - impl_
ckks_ copy_ defaults - impl_
ckks_ dft_ defaults - Wires a backend into the reference homomorphic-DFT chain: implements the
[
DFTDefault] and [DFTMatrixDefault] marker impls, inheriting every default-bodied method (which forward tocrate::default::dft). - impl_
ckks_ encapsulated_ mod_ up_ default - Opts a backend into the CKKS reference encapsulated-ModUp pipeline.
- impl_
ckks_ encryption_ defaults - impl_
ckks_ imag_ defaults - impl_
ckks_ infos - Implements the full CKKS scratch-view trait bundle for a nominal backend
view wrapper:
CKKSInfos,SetCKKSInfos,SetK,BSGSMeta, andSetBSGSMeta. - impl_
ckks_ mul_ defaults - impl_
ckks_ neg_ defaults - impl_
ckks_ plaintext_ defaults - impl_
ckks_ pow2_ defaults - impl_
ckks_ rotate_ defaults - impl_
ckks_ sub_ defaults
Structs§
- CKKS
Layout - Allocation / precision spec for a CKKS value.
- CKKS
Meta - CKKS semantic precision metadata carried by ciphertexts and plaintexts.
- Coeffs
Meta - Coefficient metadata for plan-compiled operands: the DFT factor diagonals
(
layouts::DFTPlan), the EvalMod polynomial coefficients (layouts::EvalModPlan), and the BSGS polynomial encoders (polynomial::EncodeBSGS).
Enums§
- CKKS
Composition Error - CKKS composition and alignment errors returned by high-level operations.
- CKKS
Error - Typed error returned by every fallible CKKS operation (the
apiop traits and the layers backing them). - Slots
Kind - Which subfield the encoded slots are known to live in.
Traits§
- CKKS
CtBounds - Marker bound for CKKS ciphertext type parameters.
- CKKS
Infos - Common metadata accessors for CKKS ciphertext and plaintext containers.
- CKKS
Plaintext ToBackend Mut - Backend-compatible mutable CKKS plaintext storage.
- CKKS
Plaintext ToBackend Ref - Backend-compatible shared CKKS plaintext storage.
- SetCKKS
Infos - Mutable CKKS metadata access for ciphertext/plaintext containers.
Type Aliases§
- CKKS
Result - Result type of every fallible CKKS operation.