🐙 Poulpy-Core
Poulpy-Core is a Rust crate built on poulpy-hal, providing scheme- and backend-agnostic RLWE-based homomorphic encryption building blocks.
Getting Started
use FFT64;
use ;
use ;
Layouts
This crate defines three categories of layouts for LWE, GLWE, GGLWE, and GGSW objects (and their derivatives), all instantiated using poulpy-hal layouts. Each serves a distinct purpose:
- Standard → Front-end, serializable layouts. These are backend-agnostic and act as inputs/outputs of computations (e.g.,
GGLWEAutomorphismKey). - Compressed → Compact serializable variants of the standard layouts. They are not usable for computation but significantly reduce storage size (e.g.,
GGLWEAutomorphismKeyCompressed). - Prepared → Backend-optimized, opaque layouts used only for computation (write-only). These store preprocessed data for efficient execution on a specific backend (e.g.,
GGLWEAutomorphismKeyPrepared).
All standard and compressed layouts implement the WriterTo and ReaderFrom traits, enabling straightforward serialization/deserialization with any type implementing Write or Read:
Example Workflow
flowchart TD
A[GGLWEAutomorphismKeyCompressed]-->|decompress|B[GGLWEAutomorphismKey]-->|prepare|C[GGLWEAutomorphismKeyPrepared]
Equivalent Rust:
let mut atk_compressed: =
alloc;
let mut atk: =
alloc;
atk.decompress;
let mut atk_prep: = = atk.prepare_alloc;
Encryption & Decryption
- Encryption → Supported for all standard and compressed layouts.
- Decryption → Only directly available for
LWECiphertextandGLWECiphertext. However, it remains naturally usable onGGLWEandGGSWobjects, since these are vectors/matrices ofGLWECiphertext.
let mut atk: =
alloc;
atk.encrypt_sk;
atk.at.decrypt;
Keyswitching, Automorphism & External Product
Keyswitching, automorphisms, and external products are supported for all ciphertext types where they are well-defined.
This includes subtypes such as GGLWEAutomorphismKey.
For example:
atk.external_product;
ggsw.automorphism;
Additional Features
- Ciphertexts:
LWEandGLWE GLWEring packingGLWEtrace- Noise analysis for
GLWE,GGLWE,GGSW - Basic operations over
GLWEciphertexts and plaintexts
Tests
A fully generic test suite is available in src/tests/generics.