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.
Overview
The encryption module provides functions for encrypting plaintext values (integers) and field elements into PVAC-HFHE ciphertexts. All encryption operations support multi-slot ciphertexts for SIMD-style computation.Core encryption functions
enc_value
Encrypts a single unsigned 64-bit integer into a ciphertext.
Public key for encryption
Secret key for generating noise
The plaintext value to encrypt
A ciphertext encrypting the value with depth 0
Description
Encrypts a single integer value using masking and fusion. The plaintext is split intov + m and -m where m is a random mask, then both parts are encrypted and combined.
See: encrypt.hpp:740
enc_value_depth
Encrypts a single value with a specific noise budget for a given circuit depth.
Public key for encryption
Secret key for generating noise
The plaintext value to encrypt
Depth hint for noise budget computation
A ciphertext with noise budget allocated for depth
dDescription
Encrypts a value with noise budget planned for a circuit of depthd. Higher depth values allocate more noise entropy for deeper computations.
See: encrypt.hpp:732
enc_values
Encrypts multiple values into a single multi-slot ciphertext.
Public key for encryption
Secret key for generating noise
Vector of plaintext values to encrypt in parallel slots
A multi-slot ciphertext encrypting all values in parallel
Description
Creates a ciphertext with multiple slots, each encrypting one value from the input vector. Enables SIMD-style parallel computation on batched data. See: encrypt.hpp:753enc_values_depth
Encrypts multiple values with depth-specific noise budget.
Public key for encryption
Secret key for generating noise
Vector of plaintext values
Depth hint for noise allocation
Multi-slot ciphertext with depth
d noise budgetenc_zero_depth
Encrypts the value zero with a specified noise budget.
Public key for encryption
Secret key for generating noise
Depth hint for noise budget
Ciphertext encrypting zero
Description
Generates a zero ciphertext with fresh noise. Used primarily for bootstrapping and recryption operations to refresh noise without changing the encrypted value. See: encrypt.hpp:757Field element encryption
enc_fp_depth
Encrypts a field element with specified depth.
Public key
Secret key
Field element to encrypt
Depth hint
Ciphertext encrypting the field element
enc_fp_depth (multi-slot)
Encrypts a vector of field elements.
Public key
Secret key
Vector of field elements
Depth hint
Multi-slot ciphertext
Utility functions
combine_ciphers
Combines two ciphertexts into a single ciphertext by fusing their layer graphs.
Public key
First ciphertext
Second ciphertext
Fused ciphertext with combined layers and edges
Description
Merges the layer DAGs and edge sets of two ciphertexts. Layer indices fromb are offset appropriately. Used internally during encryption and arithmetic operations.
The function automatically compacts edges if the budget is exceeded.
plan_noise
Computes the noise budget allocation for a given depth.
Public key with parameter set
Expected circuit depth
Pair of
(n2, n3) where n2 is the number of 2-tuples and n3 is the number of 3-tuples to allocateDescription
Computes the optimal noise budget based on the parameter set’s entropy capacity and the expected circuit depth. The allocation is split between 2-tuples and 3-tuples according totuple2_fraction.
See: encrypt.hpp:643
sigma_density
Computes the sigma vector density of a ciphertext.
Public key
Ciphertext to analyze
Density ratio between 0.0 and 1.0
Description
Computes the fraction of set bits across all sigma vectors in the ciphertext. A density near 0.5 indicates well-balanced noise. Values far from 0.5 may indicate the need for recryption. See: encrypt.hpp:648compact_edges
Compacts the edge set by merging edges with the same layer, index, and sign.
Public key
Ciphertext to compact (modified in place)
Description
Reduces the ciphertext size by merging redundant edges. This operation does not change the encrypted value but improves efficiency. See: encrypt.hpp:658compact_layers
Removes unused layers from the ciphertext.
Ciphertext to compact (modified in place)