How panosvl/lattice-ibe-optimizations works
1. Repository shape
This is a small, self-contained C++ proof-of-concept for an identity-based encryption (IBE) scheme over NTRU lattices. It is not a multi-service system; the architecture is a single executable built from a handful of math-heavy source files.
2. Build and runtime boundary
The project is built with Makefile into a single program named IBE. The runtime expects a Unix-like environment with g++, and the code links against GMP and NTL for big integers / number theory primitives. Those libraries are external dependencies that materially shape the implementation.
3. Configuration layer
params.h is the main compile-time configuration boundary. The README says the key tunables are N0 and q0, which means the system’s dimensions and modulus are fixed at compile time rather than loaded dynamically.
4. Core algebra subsystem
Algebra.cc/.h is the foundational math layer. It likely defines the polynomial / ring arithmetic and other lattice-algebra operations used throughout the scheme. In an architecture diagram, this is the lowest-level internal dependency that everything else builds on.
5. FFT acceleration subsystem
FFT.cc/.h provides the fast transform machinery used to accelerate polynomial multiplication or related ring operations. This sits alongside the algebra layer and is likely called by the arithmetic routines and scheme implementation when efficiency matters.
6. Randomness and sampling subsystem
Random.cc/.h and Sampling.cc/.h form the stochastic side of the implementation. Random is the entropy source / PRNG wrapper, while Sampling likely implements the discrete distributions required by lattice cryptography, such as short-vector or Gaussian-like sampling.
7. Scheme logic
Scheme.cc/.h is the main cryptographic protocol layer. This is where the IBE-specific operations are assembled: setup, identity-based key extraction, encryption, and decryption. It depends on algebra, FFT, random, and sampling rather than the other way around.
8. Top-level executable
IBE.cc is the entry point / driver. It likely wires together parameter initialization, setup, test vectors or demonstrations, and invokes the scheme operations. In architectural terms, it is the application shell around the cryptographic core.
9. Input/output boundary
io.cc/.h is a utility layer for reading/writing values, vectors, or scheme artifacts. It is not the main business logic, but it forms the boundary between internal cryptographic objects and external representation.
10. Data flow through the system
The typical flow is: compile-time parameters from params.h define the lattice instance; IBE.cc drives execution; Scheme calls into Sampling and Random to generate secrets or masks; Scheme and Algebra use FFT-accelerated arithmetic to manipulate lattice elements; results are emitted through io.
11. Architectural boundaries to draw
For a diagram, the most important separation is between:
- Driver / executable (IBE.cc)
- Protocol layer (Scheme)
- Mathematical primitives (Algebra, FFT)
- Randomness / sampling (Random, Sampling)
- Serialization / I/O (io)
- Static configuration (params.h)
External libraries (GMP, NTL) sit beneath the math layer as foundational dependencies.
12. Practical characterization
This is a research implementation, not production crypto infrastructure. There are no network services, databases, or background workers; the architecture is a deterministic computation pipeline with a heavy reliance on numerical libraries and fixed parameters.
Main entry points: Algebra.cc Algebra · Scheme.cc Scheme · IBE.cc IBE · FFT.cc FFT
Components 15
Build & entry
Compilation target and executable entry point
IBE protocol
High-level cryptographic operations
- Scheme · Main IBE protocol layer coordinating setup, key extraction, encryption, and decryption
Scheme.cc - Setup · Initializes public parameters and master secrets
- Key extract · Derives identity-bound private keys
- Encrypt · Encodes plaintexts into ciphertexts for an identity
- Decrypt · Recovers plaintexts from ciphertexts using identity keys
Math core
Lattice and polynomial arithmetic
Randomness
Entropy and discrete sampling
Support
Configuration and I/O boundary
External libs
Foundational third-party number theory dependencies
- GMP · Big integer arithmetic dependency
- NTL · Number theory and polynomial algebra dependency
Connections 21
- Makefile → IBE: builds · Compiles the executable from the source files
- IBE → params: uses · Runs with fixed compile-time dimensions and modulus
- IBE → Scheme: drives · Main driver invokes the cryptographic workflow
- IBE → I/O: formats · Uses I/O helpers for external representation
- Scheme → Setup: contains · Protocol setup stage
- Scheme → Key extract: contains · Identity key extraction stage
- Scheme → Encrypt: contains · Encryption stage
- Scheme → Decrypt: contains · Decryption stage
- Setup → Algebra: uses · Builds scheme objects from core arithmetic
- Key extract → Sampling: uses · Samples secret material
- Encrypt → Random: uses · Generates randomness and masks
- Encrypt → Sampling: uses · Samples noise and short vectors
- Encrypt → FFT: accelerates · Uses fast transforms for polynomial multiplication
- Decrypt → Algebra: uses · Applies ring arithmetic during recovery
- Algebra → FFT: delegates · Relies on FFT-backed polynomial operations
- Algebra → GMP: depends on · Uses big integer support
- Algebra → NTL: depends on · Uses number theory primitives
- FFT → NTL: depends on · Builds on NTL polynomial machinery
- Random → GMP: depends on · Uses external big integer support where needed
- Sampling → Random: depends on · Draws entropy from the RNG layer
- I/O → Algebra: serializes · Converts algebraic objects to and from text or binary forms