Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/octra-labs/pvac_hfhe_cpp/llms.txt

Use this file to discover all available pages before exploring further.

Prerequisites

Before installing PVAC-HFHE, ensure your development environment meets these requirements:
1

C++17 compiler

You need a compiler that supports C++17 or later:
  • GCC: Version 9 or higher
  • Clang: Version 10 or higher
  • MSVC: Visual Studio 2019 or higher
g++ --version
# Should show gcc version 9.0.0 or higher
2

x86-64 processor (recommended)

For optimal performance, use a processor with PCLMUL support. Most modern Intel and AMD processors include this instruction set.Check PCLMUL support on Linux:
grep -o 'pclmulqdq' /proc/cpuinfo | head -n 1
PVAC-HFHE will work without PCLMUL, but cryptographic operations will be slower.

Clone the repository

PVAC-HFHE is a header-only library, so installation is straightforward:
git clone https://github.com/octra-labs/pvac_hfhe_cpp.git
cd pvac_hfhe_cpp

Project structure

After cloning, your directory should look like this:
pvac_hfhe_cpp/
├── include/
│   └── pvac/
│       ├── pvac.hpp          # Main header file
│       ├── core/             # Core cryptographic primitives
│       ├── crypto/           # Key generation and LPN
│       ├── ops/              # Encryption/decryption operations
│       └── utils/            # Utilities for text and metrics
├── examples/                 # Example applications
├── tests/                    # Test suite
└── Makefile                  # Build configuration

Include in your project

PVAC-HFHE is header-only, so you just need to add the include path:
#include <pvac/pvac.hpp>

using namespace pvac;

int main() {
    // Your PVAC-HFHE code here
    return 0;
}
Always use -march=native flag to enable CPU-specific optimizations, including PCLMUL instructions if available.

Compiler flags explained

FlagPurpose
-std=c++17Enable C++17 standard support (required)
-O2Enable optimization level 2 for better performance
-march=nativeUse CPU-specific instructions (PCLMUL, AVX, etc.)
-I./includeAdd the include directory to the compiler search path
For production builds, consider using -O3 for maximum optimization, though it may increase compilation time.

Verify installation

Test your installation by building and running the examples:
1

Build examples

make examples
This compiles all example programs in the examples/ directory.
2

Run basic usage example

./build/examples/basic_usage
You should see output showing successful encryption, homomorphic operations, and decryption:
pvac_hfhe 0.1.0

 - 1. keygen - 
   H = 0x...
   m = 8192, n = 4096, B = 16

 - 2. enc / dec - 
   ok: dec(42) = 42
   ok: dec(17) = 17
3

Run test suite (optional)

Verify everything works correctly by running the full test suite:
make test
This runs 42 comprehensive tests covering all library functionality.

Integration methods

Method 1: Direct include path

Add the PVAC-HFHE include directory to your compiler flags:
g++ -std=c++17 -O2 -march=native -I/path/to/pvac_hfhe_cpp/include main.cpp -o app

Method 2: Copy headers to system path

Copy headers to your system include directory:
sudo cp -r include/pvac /usr/local/include/
Then compile without the -I flag:
g++ -std=c++17 -O2 -march=native main.cpp -o app

Method 3: CMake integration

For CMake projects, add the include directory:
CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(MyProject)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Add PVAC-HFHE include directory
include_directories(/path/to/pvac_hfhe_cpp/include)

# Enable optimizations
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -march=native")

add_executable(my_app main.cpp)

Troubleshooting

This indicates your compiler doesn’t fully support C++17. Update to:
  • GCC 9 or higher
  • Clang 10 or higher
  • MSVC 2019 or higher
PVAC-HFHE is header-only and doesn’t require linking. Ensure you’re including pvac/pvac.hpp in your source files.
Ensure you’re compiling with optimization flags:
  • Add -O2 or -O3 for optimization
  • Add -march=native to enable CPU-specific instructions
  • Check that your CPU supports PCLMUL instructions
Verify the include path is correct:
# Check the include directory exists
ls /path/to/pvac_hfhe_cpp/include/pvac/pvac.hpp

# Add -I flag pointing to the include directory
g++ -I/path/to/pvac_hfhe_cpp/include ...

Next steps

Quickstart guide

Build your first homomorphic encryption application.

Basic operations

Learn the fundamental operations for working with encrypted data.

Build docs developers (and LLMs) love