Intel HEXL
Intel Homomorphic Encryption Acceleration Library, accelerating the modular arithmetic operations used in homomorphic encryption.
|
Classes | |
class | NTT |
Performs negacyclic forward and inverse number-theoretic transform (NTT), commonly used in RLWE cryptography. More... | |
Enumerations | |
enum | CMPINT { CMPINT::EQ = 0, CMPINT::LT = 1, CMPINT::LE = 2, CMPINT::FALSE = 3, CMPINT::NE = 4, CMPINT::NLT = 5, CMPINT::NLE = 6, CMPINT::TRUE = 7 } |
Represents binary operations between two boolean values. More... | |
Functions | |
void | EltwiseAddMod (uint64_t *result, const uint64_t *operand1, const uint64_t *operand2, uint64_t n, uint64_t modulus) |
Adds two vectors elementwise with modular reduction. More... | |
void | EltwiseCmpAdd (uint64_t *result, const uint64_t *operand1, CMPINT cmp, uint64_t bound, uint64_t diff, uint64_t n) |
Computes element-wise conditional addition. More... | |
void | EltwiseCmpSubMod (uint64_t *result, const uint64_t *operand1, CMPINT cmp, uint64_t bound, uint64_t diff, uint64_t modulus, uint64_t n) |
Computes element-wise conditional modular subtraction. More... | |
void | EltwiseFMAMod (uint64_t *result, const uint64_t *arg1, uint64_t arg2, const uint64_t *arg3, uint64_t n, uint64_t modulus, uint64_t input_mod_factor) |
Computes fused multiply-add (arg1 * arg2 + arg3 ) mod modulus element-wise, broadcasting scalars to vectors. More... | |
void | EltwiseMultMod (uint64_t *result, const uint64_t *operand1, const uint64_t *operand2, uint64_t n, uint64_t modulus, uint64_t input_mod_factor) |
Multiplies two vectors elementwise with modular reduction. More... | |
void | EltwiseReduceMod (uint64_t *result, const uint64_t *operand, uint64_t modulus, uint64_t n, uint64_t input_mod_factor, uint64_t output_mod_factor) |
Performs elementwise modular reduction. More... | |
CMPINT | Not (CMPINT cmp) |
Returns the logical negation of a binary operation. More... | |
|
strong |
void intel::hexl::EltwiseAddMod | ( | uint64_t * | result, |
const uint64_t * | operand1, | ||
const uint64_t * | operand2, | ||
uint64_t | n, | ||
uint64_t | modulus | ||
) |
Adds two vectors elementwise with modular reduction.
[out] | result | Stores result |
[in] | operand1 | Vector of elements to add. Each element must be less than the modulus |
[in] | operand2 | Vector of elements to add. Each element must be less than the modulus |
[in] | n | Number of elements in each vector |
[in] | modulus | Modulus with which to perform modular reduction. Must be in the range \([2, 2^{63} - 1]\) |
Computes \( operand1[i] = (operand1[i] + operand2[i]) \mod modulus \) for \( i=0, ..., n-1\).
void intel::hexl::EltwiseCmpAdd | ( | uint64_t * | result, |
const uint64_t * | operand1, | ||
CMPINT | cmp, | ||
uint64_t | bound, | ||
uint64_t | diff, | ||
uint64_t | n | ||
) |
Computes element-wise conditional addition.
[out] | result | Stores the result |
[in] | operand1 | Vector of elements to compare; stores result |
[in] | cmp | Comparison operation |
[in] | bound | Scalar to compare against |
[in] | diff | Scalar to conditionally add |
[in] | n | Number of elements in operand1 |
Computes result[i] = cmp(operand1[i], bound) ? operand1[i] + diff : operand1[i] for all \(i=0, ..., n-1\).
void intel::hexl::EltwiseCmpSubMod | ( | uint64_t * | result, |
const uint64_t * | operand1, | ||
CMPINT | cmp, | ||
uint64_t | bound, | ||
uint64_t | diff, | ||
uint64_t | modulus, | ||
uint64_t | n | ||
) |
Computes element-wise conditional modular subtraction.
[out] | result | Stores the result |
[in] | operand1 | Vector of elements to compare |
[in] | cmp | Comparison function |
[in] | bound | Scalar to compare against |
[in] | diff | Scalar to subtract by |
[in] | modulus | Modulus to reduce by |
[in] | n | Number of elements in operand1 |
Computes operand1
[i] = (cmp
(operand1
, bound
)) ? (operand1
- diff
) mod modulus
: operand1
for all i=0, ..., n-1
void intel::hexl::EltwiseFMAMod | ( | uint64_t * | result, |
const uint64_t * | arg1, | ||
uint64_t | arg2, | ||
const uint64_t * | arg3, | ||
uint64_t | n, | ||
uint64_t | modulus, | ||
uint64_t | input_mod_factor | ||
) |
Computes fused multiply-add (arg1
* arg2
+ arg3
) mod modulus
element-wise, broadcasting scalars to vectors.
[out] | result | Stores the result |
[in] | arg1 | Vector to multiply |
[in] | arg2 | Scalar to multiply |
[in] | arg3 | Vector to add. Will not add if arg3 == nullptr |
[in] | n | Number of elements in each vector |
[in] | modulus | Modulus with which to perform modular reduction. Must be in the range \( [2, 2^{61} - 1]\) |
[in] | input_mod_factor | Assumes input elements are in [0, input_mod_factor * p). Must be 1, 2, 4, or 8. |
void intel::hexl::EltwiseMultMod | ( | uint64_t * | result, |
const uint64_t * | operand1, | ||
const uint64_t * | operand2, | ||
uint64_t | n, | ||
uint64_t | modulus, | ||
uint64_t | input_mod_factor | ||
) |
Multiplies two vectors elementwise with modular reduction.
[in] | result | Result of element-wise multiplication |
[in] | operand1 | Vector of elements to multiply. Each element must be less than the modulus. |
[in] | operand2 | Vector of elements to multiply. Each element must be less than the modulus. |
[in] | n | Number of elements in each vector |
[in] | modulus | Modulus with which to perform modular reduction |
[in] | input_mod_factor | Assumes input elements are in [0, input_mod_factor * p) Must be 1, 2 or 4. |
Computes result
[i] = (operand1
[i] * operand2
[i]) mod modulus
for i=0, ..., n
- 1
void intel::hexl::EltwiseReduceMod | ( | uint64_t * | result, |
const uint64_t * | operand, | ||
uint64_t | modulus, | ||
uint64_t | n, | ||
uint64_t | input_mod_factor, | ||
uint64_t | output_mod_factor | ||
) |
Performs elementwise modular reduction.
[out] | result | Stores the result |
[in] | operand | |
[in] | n | Number of elements in operand |
[in] | modulus | Modulus with which to perform modular reduction |
[in] | input_mod_factor | Assumes input elements are in [0, input_mod_factor * p) Must be 0, 1, 2 or 4. input_mod_factor=0 means, no knowledge of input range. Barrett reduction will be used in this case. input_mod_factor >= output_mod_factor unless input_mod_factor == 0 |
[in] | output_mod_factor | output elements will be in [0, output_mod_factor
|