Intel HE Acceleration Library for FPGAs
Intel Homomorphic Encryption Acceleration Library for FPGAs, accelerating the modular arithmetic operations used in homomorphic encryption on Intel FPGAs.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
hetest::utils Namespace Reference

Namespaces

 details
 

Classes

class  MultiplyFactor
 
class  NTT
 Performs negacyclic forward and inverse number-theoretic transform (NTT), commonly used in RLWE cryptography. More...
 
struct  AllocatorBase
 
struct  AllocatorInterface
 
class  AlignedAllocator
 

Typedefs

using AllocatorStrategyPtr = std::shared_ptr< AllocatorBase >
 
template<typename T >
using AlignedVector64 = std::vector< T, AlignedAllocator< T, 64 > >
 

Enumerations

enum  StimulusType {
  RANDOM = 0, RAMP, ALL_ONES, ALL_ZEROS,
  IMPULSE, ALL_MAX_VALUES, ALL_MIN_VALUES, RANDOM = 0,
  RAMP, ALL_ONES, ALL_ZEROS, IMPULSE,
  ALL_MAX_VALUES, ALL_MIN_VALUES
}
 
enum  StimulusType {
  RANDOM = 0, RAMP, ALL_ONES, ALL_ZEROS,
  IMPULSE, ALL_MAX_VALUES, ALL_MIN_VALUES, RANDOM = 0,
  RAMP, ALL_ONES, ALL_ZEROS, IMPULSE,
  ALL_MAX_VALUES, ALL_MIN_VALUES
}
 
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

uint64_t InverseUIntMod (uint64_t input, uint64_t modulus)
 
uint64_t BarrettReduce64 (uint64_t input, uint64_t modulus, uint64_t q_barr)
 
uint64_t MultiplyUIntMod (uint64_t x, uint64_t y, uint64_t modulus)
 
uint64_t MultiplyMod (uint64_t x, uint64_t y, uint64_t y_precon, uint64_t modulus)
 
uint64_t AddUIntMod (uint64_t x, uint64_t y, uint64_t modulus)
 
uint64_t SubUIntMod (uint64_t x, uint64_t y, uint64_t modulus)
 
uint64_t PowMod (uint64_t base, uint64_t exp, uint64_t modulus)
 
bool IsPrimitiveRoot (uint64_t root, uint64_t degree, uint64_t modulus)
 
uint64_t GeneratePrimitiveRoot (uint64_t degree, uint64_t modulus)
 
uint64_t MinimalPrimitiveRoot (uint64_t degree, uint64_t modulus)
 
uint64_t ReverseBitsUInt (uint64_t x, uint64_t bit_width)
 
bool IsPrime (uint64_t n)
 
std::vector< uint64_t > GeneratePrimes (size_t num_primes, size_t bit_size, size_t ntt_size)
 
void ForwardTransformToBitReverse64 (uint64_t *operand, uint64_t n, uint64_t modulus, const uint64_t *root_of_unity_powers, const uint64_t *precon_root_of_unity_powers, uint64_t input_mod_factor, uint64_t output_mod_factor)
 
void ReferenceForwardTransformToBitReverse (uint64_t *operand, uint64_t n, uint64_t modulus, const uint64_t *root_of_unity_powers)
 Reference NTT which is written for clarity rather than performance. More...
 
void InverseTransformFromBitReverse64 (uint64_t *operand, uint64_t n, uint64_t modulus, const uint64_t *inv_root_of_unity_powers, const uint64_t *precon_inv_root_of_unity_powers, uint64_t input_mod_factor, uint64_t output_mod_factor)
 
bool CheckNTTArguments (uint64_t degree, uint64_t modulus)
 
template<int BitShift>
uint64_t MultiplyUIntModLazy (uint64_t x, uint64_t y_operand, uint64_t y_barrett_factor, uint64_t modulus)
 
template<int BitShift>
uint64_t MultiplyUIntModLazy (uint64_t x, uint64_t y, uint64_t modulus)
 
unsigned char AddUInt64 (uint64_t operand1, uint64_t operand2, uint64_t *result)
 
template<int InputModFactor>
uint64_t ReduceMod (uint64_t x, uint64_t modulus, const uint64_t *twice_modulus=nullptr, const uint64_t *four_times_modulus=nullptr)
 
CMPINT Not (CMPINT cmp)
 Returns the logical negation of a binary operation. More...
 
uint128_t MultiplyUInt64 (uint64_t x, uint64_t y)
 
uint64_t BarrettReduce128 (uint64_t input_hi, uint64_t input_lo, uint64_t modulus)
 
uint64_t DivideUInt128UInt64Lo (uint64_t x1, uint64_t x0, uint64_t y)
 
void MultiplyUInt64 (uint64_t x, uint64_t y, uint64_t *prod_hi, uint64_t *prod_lo)
 
template<int BitShift>
uint64_t MultiplyUInt64Hi (uint64_t x, uint64_t y)
 
uint64_t MSB (uint64_t input)
 
bool Compare (CMPINT cmp, uint64_t lhs, uint64_t rhs)
 
bool IsPowerOfTwo (uint64_t num)
 
uint64_t Log2 (uint64_t x)
 
uint64_t MaximumValue (uint64_t bits)
 

Variables

AllocatorStrategyPtr mallocStrategy
 

Typedef Documentation

template<typename T >
using hetest::utils::AlignedVector64 = typedef std::vector<T, AlignedAllocator<T, 64> >
using hetest::utils::AllocatorStrategyPtr = typedef std::shared_ptr<AllocatorBase>

Enumeration Type Documentation

enum hetest::utils::CMPINT
strong

Represents binary operations between two boolean values.

Enumerator
EQ 

Equal.

LT 

Less than.

LE 

Less than or equal.

FALSE 

False.

NE 

Not equal.

NLT 

Not less than.

NLE 

Not less than or equal.

TRUE 

True.

Enumerator
RANDOM 
RAMP 
ALL_ONES 
ALL_ZEROS 
IMPULSE 
ALL_MAX_VALUES 
ALL_MIN_VALUES 
RANDOM 
RAMP 
ALL_ONES 
ALL_ZEROS 
IMPULSE 
ALL_MAX_VALUES 
ALL_MIN_VALUES 
Enumerator
RANDOM 
RAMP 
ALL_ONES 
ALL_ZEROS 
IMPULSE 
ALL_MAX_VALUES 
ALL_MIN_VALUES 
RANDOM 
RAMP 
ALL_ONES 
ALL_ZEROS 
IMPULSE 
ALL_MAX_VALUES 
ALL_MIN_VALUES 

Function Documentation

unsigned char hetest::utils::AddUInt64 ( uint64_t  operand1,
uint64_t  operand2,
uint64_t *  result 
)
inline
uint64_t hetest::utils::AddUIntMod ( uint64_t  x,
uint64_t  y,
uint64_t  modulus 
)
uint64_t hetest::utils::BarrettReduce128 ( uint64_t  input_hi,
uint64_t  input_lo,
uint64_t  modulus 
)
inline
uint64_t hetest::utils::BarrettReduce64 ( uint64_t  input,
uint64_t  modulus,
uint64_t  q_barr 
)
bool hetest::utils::CheckNTTArguments ( uint64_t  degree,
uint64_t  modulus 
)
bool hetest::utils::Compare ( CMPINT  cmp,
uint64_t  lhs,
uint64_t  rhs 
)
inline
uint64_t hetest::utils::DivideUInt128UInt64Lo ( uint64_t  x1,
uint64_t  x0,
uint64_t  y 
)
inline
void hetest::utils::ForwardTransformToBitReverse64 ( uint64_t *  operand,
uint64_t  n,
uint64_t  modulus,
const uint64_t *  root_of_unity_powers,
const uint64_t *  precon_root_of_unity_powers,
uint64_t  input_mod_factor,
uint64_t  output_mod_factor 
)
std::vector< uint64_t > hetest::utils::GeneratePrimes ( size_t  num_primes,
size_t  bit_size,
size_t  ntt_size 
)
uint64_t hetest::utils::GeneratePrimitiveRoot ( uint64_t  degree,
uint64_t  modulus 
)
void hetest::utils::InverseTransformFromBitReverse64 ( uint64_t *  operand,
uint64_t  n,
uint64_t  modulus,
const uint64_t *  inv_root_of_unity_powers,
const uint64_t *  precon_inv_root_of_unity_powers,
uint64_t  input_mod_factor,
uint64_t  output_mod_factor 
)
uint64_t hetest::utils::InverseUIntMod ( uint64_t  input,
uint64_t  modulus 
)
bool hetest::utils::IsPowerOfTwo ( uint64_t  num)
inline
bool hetest::utils::IsPrime ( uint64_t  n)
bool hetest::utils::IsPrimitiveRoot ( uint64_t  root,
uint64_t  degree,
uint64_t  modulus 
)
uint64_t hetest::utils::Log2 ( uint64_t  x)
inline
uint64_t hetest::utils::MaximumValue ( uint64_t  bits)
inline
uint64_t hetest::utils::MinimalPrimitiveRoot ( uint64_t  degree,
uint64_t  modulus 
)
uint64_t hetest::utils::MSB ( uint64_t  input)
inline
uint64_t hetest::utils::MultiplyMod ( uint64_t  x,
uint64_t  y,
uint64_t  y_precon,
uint64_t  modulus 
)
uint128_t hetest::utils::MultiplyUInt64 ( uint64_t  x,
uint64_t  y 
)
inline
void hetest::utils::MultiplyUInt64 ( uint64_t  x,
uint64_t  y,
uint64_t *  prod_hi,
uint64_t *  prod_lo 
)
inline
template<int BitShift>
uint64_t hetest::utils::MultiplyUInt64Hi ( uint64_t  x,
uint64_t  y 
)
inline
uint64_t hetest::utils::MultiplyUIntMod ( uint64_t  x,
uint64_t  y,
uint64_t  modulus 
)
template<int BitShift>
uint64_t hetest::utils::MultiplyUIntModLazy ( uint64_t  x,
uint64_t  y_operand,
uint64_t  y_barrett_factor,
uint64_t  modulus 
)
inline
template<int BitShift>
uint64_t hetest::utils::MultiplyUIntModLazy ( uint64_t  x,
uint64_t  y,
uint64_t  modulus 
)
inline
CMPINT hetest::utils::Not ( CMPINT  cmp)
inline

Returns the logical negation of a binary operation.

Parameters
[in]cmpThe binary operation to negate
uint64_t hetest::utils::PowMod ( uint64_t  base,
uint64_t  exp,
uint64_t  modulus 
)
template<int InputModFactor>
uint64_t hetest::utils::ReduceMod ( uint64_t  x,
uint64_t  modulus,
const uint64_t *  twice_modulus = nullptr,
const uint64_t *  four_times_modulus = nullptr 
)
void hetest::utils::ReferenceForwardTransformToBitReverse ( uint64_t *  operand,
uint64_t  n,
uint64_t  modulus,
const uint64_t *  root_of_unity_powers 
)

Reference NTT which is written for clarity rather than performance.

Parameters
[in,out]operandInput data. Overwritten with NTT output
[in]nSize of the transfrom, i.e. the polynomial degree. Must be a power of two.
[in]modulusPrime modulus. Must satisfy q == 1 mod 2n
[in]root_of_unity_powersPowers of 2n'th root of unity in F_q. In bit-reversed order
uint64_t hetest::utils::ReverseBitsUInt ( uint64_t  x,
uint64_t  bit_width 
)
uint64_t hetest::utils::SubUIntMod ( uint64_t  x,
uint64_t  y,
uint64_t  modulus 
)

Variable Documentation

AllocatorStrategyPtr hetest::utils::mallocStrategy
Initial value:
=
AllocatorStrategyPtr(new details::MallocStrategy)
std::shared_ptr< AllocatorBase > AllocatorStrategyPtr
Definition: utils-test.hpp:277