|
ComputeFHE 1.0
General-Purpose Privacy-Preserving Computation Library for TFHE
|
The core manager class for the ComputeFHE library. More...
#include <ComputeFHE.h>
Public Member Functions | |
| ComputeFHE (bool simulation_mode=false) | |
| Constructs a ComputeFHE instance. | |
| ComputeFHE (CryptoContextParam param, bool simulation_mode=false) | |
| Constructs a ComputeFHE instance with specific parameters. | |
| ComputeFHE (CryptoContextParam param, ALUType alu_type, bool simulation_mode=false) | |
| Constructs a ComputeFHE instance with specific parameters and ALU type. | |
| ComputeFHE (ALUType alu_type, bool simulation_mode=false) | |
| Constructs a ComputeFHE instance with a specific ALU type. | |
| ~ComputeFHE () | |
| Destructor. Cleans up ALU and context resources. | |
| BinFHEContext & | GetBinFHEContext () |
| Returns the underlying OpenFHE BinFHEContext. | |
| BaseALU * | GetALU () |
| Returns the active ALU implementation. | |
| BaseALUSimulator * | GetSimulator () |
| Returns the simulator instance. Only valid in simulation mode. Returns nullptr if simulation mode is disabled. | |
| CryptoContextParam | GetCryptoContextParam () |
| Returns the current cryptographic context parameters. | |
| ALUType | GetALUType () |
| Returns the current ALU type (STANDARD or OPTIMIZED). | |
| const LWEPrivateKey & | GetLWEPrivateKey () |
| Returns the LWE Private Key. Requires CLIENT_MODE to be true. | |
| void | SetLWEPrivateKey (const LWEPrivateKey &sk) |
| Sets the LWE Private Key. | |
| void | generateKeys () |
| Generates the secret key and switching keys for the context. | |
| FixedPoint | EncryptInt (uint64_t pt, size_t n_digits=8, bool fresh=true) |
| Encrypts a 64-bit integer into a FixedPoint bit-vector. | |
| uint64_t | DecryptInt (const FixedPoint &ct, size_t n_digits=0) |
| Decrypts a FixedPoint bit-vector back into a 64-bit integer. | |
| BinaryDigit | EncryptBool (bool pt, bool fresh=true) |
| Encrypts a single boolean value. | |
| bool | DecryptBool (const BinaryDigit &ct) |
| Decrypts a single BinaryDigit bit. | |
| FixedPoint | GetConstantInt (uint64_t pt, size_t n_digits=8) |
| Creates an unencrypted FixedPoint representation of an integer. | |
| uint64_t | ConvertConstantInt (const FixedPoint &pt) |
| Converts a constant (unencrypted) FixedPoint back to a 64-bit integer. | |
| double | extractNoise (ConstLWECiphertext &ct) |
| Estimates the noise magnitude within a specific bit. | |
| void | PrintCryptoContextParams () |
| Prints the current cryptographic context settings to stdout. | |
| void | PrintLWECiphertextParams (ConstLWECiphertext &ct) |
| Prints technical details about a specific LWE ciphertext to stdout. | |
| bool | isAutoEncryptMode () |
| Checks if Auto-Encrypt mode is enabled. | |
| void | setAutoEncryptMode (bool mode=true) |
| Sets the Auto-Encrypt mode. | |
The core manager class for the ComputeFHE library.
This class manages the OpenFHE BinFHEContext, private keys, and the active ALU implementation. It provides the primary API for encrypting/decrypting data and managing the global cryptographic state.
Constructs a ComputeFHE instance.
| simulation_mode | If true, initializes in simulation mode. |
| computefhe::ComputeFHE::ComputeFHE | ( | CryptoContextParam | param, |
| bool | simulation_mode = false |
||
| ) |
Constructs a ComputeFHE instance with specific parameters.
| param | The cryptographic context parameters. |
| simulation_mode | If true, initializes in simulation mode. |
| computefhe::ComputeFHE::ComputeFHE | ( | CryptoContextParam | param, |
| ALUType | alu_type, | ||
| bool | simulation_mode = false |
||
| ) |
Constructs a ComputeFHE instance with specific parameters and ALU type.
| param | The cryptographic context parameters. |
| alu_type | The ALU implementation to use (Standard or Optimized). |
| simulation_mode | If true, initializes in simulation mode. |
Constructs a ComputeFHE instance with a specific ALU type.
| alu_type | The ALU implementation to use. |
| simulation_mode | If true, initializes in simulation mode. |
| uint64_t computefhe::ComputeFHE::ConvertConstantInt | ( | const FixedPoint & | pt | ) |
Converts a constant (unencrypted) FixedPoint back to a 64-bit integer.
| pt | The unencrypted bit-vector. |
| bool computefhe::ComputeFHE::DecryptBool | ( | const BinaryDigit & | ct | ) |
Decrypts a single BinaryDigit bit.
| ct | The encrypted bit. |
| uint64_t computefhe::ComputeFHE::DecryptInt | ( | const FixedPoint & | ct, |
| size_t | n_digits = 0 |
||
| ) |
Decrypts a FixedPoint bit-vector back into a 64-bit integer.
| ct | The encrypted bit-vector. |
| n_digits | The number of bits to decrypt (0 defaults to vector size). |
| BinaryDigit computefhe::ComputeFHE::EncryptBool | ( | bool | pt, |
| bool | fresh = true |
||
| ) |
Encrypts a single boolean value.
| pt | The plaintext boolean. |
| fresh | If true, performs fresh encryption. |
| FixedPoint computefhe::ComputeFHE::EncryptInt | ( | uint64_t | pt, |
| size_t | n_digits = 8, |
||
| bool | fresh = true |
||
| ) |
Encrypts a 64-bit integer into a FixedPoint bit-vector.
| pt | The plaintext integer value. |
| n_digits | The bit-width of the resulting ciphertext. |
| fresh | If true, performs fresh encryption; otherwise may use cached logic. |
| double computefhe::ComputeFHE::extractNoise | ( | ConstLWECiphertext & | ct | ) |
Estimates the noise magnitude within a specific bit.
| ct | The ciphertext bit to analyze. |
| FixedPoint computefhe::ComputeFHE::GetConstantInt | ( | uint64_t | pt, |
| size_t | n_digits = 8 |
||
| ) |
Creates an unencrypted FixedPoint representation of an integer.
This is used for creating "Constant" operands. These are not cryptographically secure but allow the ALU to perform faster Ciphertext-Plaintext operations.
| pt | The plaintext integer. |
| n_digits | The bit-width. |
Sets the Auto-Encrypt mode.
When enabled, plaintext literals used in operations with encrypted types are automatically passed through EncryptInt() in client mode. When disabled or in server mode, they are treated as plaintext constants via GetConstantInt().
| mode | True to enable automatic encryption of plaintext literals. |