How openfheorg/openfhe-development works
Main Components
• Library Core Modules:
• “src/core”: Contains the fundamental building blocks such as lattice operations, math utilities, memory management, and other common routines. This is the heart of many cryptographic computations, including underlying mathematical operations, sampling routines, and utilities.
• “src/pke”: Implements public-key encryption (PKE) schemes that include variants like BFV, BGV, and CKKS. This module handles context creation, key generation, encryption, decryption, and homomorphic evaluation.
• “src/binfhe”: Implements Boolean circuit based encryption (FHEW/TFHE) and related functionalities. This module provides a separate API (BinFHEContext) for functional evaluation and Boolean operations.
• Application and Example Layers:
• “benchmark”: Contains performance and correctness benchmarks that use the core and scheme implementations.
• “demoData”, “docs”, and example subdirectories (like “src/pke/examples” and “src/binfhe/examples”) illustrate usage and provide code to demonstrate FHE capabilities.
• Build and Configuration Infrastructure:
• Top-level files and directories (CMakeLists.txt, Makefile, configure scripts, Docker configurations, CI workflows in “.github/workflows”, and “docs”) represent automated build, testing, and deployment pipelines.
• Testing and Verification:
• Unit test directories under “src/core/unittest”, “src/pke/unittest”, and “src/binfhe/unittest” provide test cases ensuring correctness.
• External Dependencies/Third-Party:
• “third-party”: Contains supporting libraries and tools (like Google Test, benchmark frameworks) used for building or testing OpenFHE components.
Relationships and Data Flow
• The core module forms the base for both PKE and BinFHE:
• Within “src/pke” and “src/binfhe”, highlight submodules dedicated to key aspects (e.g., “include”, “lib”, “examples” and “unittest”) to differentiate between the API definitions, the underlying implementations, and usage examples.
• Incorporate build and CI/CD pipeline infrastructure:
• An external build system block (denoted by “CMakeLists.txt”, “Makefile”, “scripts”, “docker”) that interacts with the source code components to produce executables and libraries.
• Documentation and Benchmarking:
• Link the “docs” folder and “benchmark” folder to the main library modules to show that they reflect both developer guidance and performance assessments.
Architectural Patterns and Design Principles
• Modular Design:
• The clear separation between core library functionalities and encryption schemes is an example of strong modular design.
• Separation of Concerns:
• Different folders encapsulate specific responsibilities (e.g., cryptographic primitives in “src/core”, high-level encryption scheme definitions and utilities in “src/pke” and “src/binfhe”).
• Reusability and Extensibility:
• The project structure supports adding new encryption schemes or extending existing ones without interfering with core functionalities.
• Integration with Automated Build and Testing:
• The presence of CI/CD workflows, Dockerfiles, and extensive unit tests has a clear impact on how development, integration, and deployment pipelines interact with the core components.
Relevant Technologies, Frameworks, and Libraries
• GNU C++ and Clang C++ (as per the README requirements).
• CMake and Makefile for building the code.
• Docker and GitHub Actions for containerization and CI/CD.
• External libraries in “third-party” such as Google Test, Google Benchmark, and gperftools used for testing and performance analysis.
Final Touches
• Every component (library, test, build tool, documentation) is clearly labeled.
• From “Core” → “PKE/BinFHE”
• From “Build Tools” → “Compilation of Modules”
• From “Unit Tests/Benchmarks” → “Modules they are testing”
• Avoid over-simplification; try to capture as many essential layers as possible.