Intel HEXL for FPGA
Intel Homomorphic Encryption FPGA Acceleration Library, accelerating the modular arithmetic operations used in homomorphic encryption.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Public Attributes | List of all members
hetest::utils::NTT Class Reference

Performs negacyclic forward and inverse number-theoretic transform (NTT), commonly used in RLWE cryptography. More...

#include <ntt.hpp>

Classes

struct  AllocatorAdapter
 
class  NTTImpl
 

Public Member Functions

 NTT ()
 Initializes an empty NTT object. More...
 
 ~NTT ()
 Destructs the NTT object. More...
 
 NTT (uint64_t degree, uint64_t q, std::shared_ptr< AllocatorBase > alloc_ptr={})
 Performs pre-computation necessary for forward and inverse transforms. More...
 
template<class Allocator , class... AllocatorArgs>
 NTT (uint64_t degree, uint64_t q, Allocator &&a, AllocatorArgs &&...args)
 
 NTT (uint64_t degree, uint64_t q, uint64_t root_of_unity, std::shared_ptr< AllocatorBase > alloc_ptr={})
 Initializes an NTT object with degree degree and modulus q. More...
 
template<class Allocator , class... AllocatorArgs>
 NTT (uint64_t degree, uint64_t q, uint64_t root_of_unity, Allocator &&a, AllocatorArgs &&...args)
 
void ComputeForward (uint64_t *result, const uint64_t *operand, uint64_t input_mod_factor, uint64_t output_mod_factor)
 Compute forward NTT. Results are bit-reversed. More...
 
void ComputeInverse (uint64_t *result, const uint64_t *operand, uint64_t input_mod_factor, uint64_t output_mod_factor)
 

Public Attributes

std::shared_ptr< NTTImplm_impl
 Class implementing the NTT. More...
 

Detailed Description

Performs negacyclic forward and inverse number-theoretic transform (NTT), commonly used in RLWE cryptography.

The number-theoretic transform (NTT) specializes the discrete Fourier transform (DFT) to the finite field \( \mathbb{Z}_q[X] / (X^N + 1) \).

Constructor & Destructor Documentation

hetest::utils::NTT::NTT ( )
default

Initializes an empty NTT object.

hetest::utils::NTT::~NTT ( )
default

Destructs the NTT object.

hetest::utils::NTT::NTT ( uint64_t  degree,
uint64_t  q,
std::shared_ptr< AllocatorBase alloc_ptr = {} 
)

Performs pre-computation necessary for forward and inverse transforms.

Initializes an NTT object with degree degree and modulus q.

Parameters
[in]degreealso known as N. Size of the NTT transform. Must be a power of 2
[in]qPrime modulus. Must satisfy \( q == 1 \mod 2N \)
[in]alloc_ptrCustom memory allocator used for intermediate calculations
template<class Allocator , class... AllocatorArgs>
hetest::utils::NTT::NTT ( uint64_t  degree,
uint64_t  q,
Allocator &&  a,
AllocatorArgs &&...  args 
)
inline
hetest::utils::NTT::NTT ( uint64_t  degree,
uint64_t  q,
uint64_t  root_of_unity,
std::shared_ptr< AllocatorBase alloc_ptr = {} 
)

Initializes an NTT object with degree degree and modulus q.

Parameters
[in]degreealso known as N. Size of the NTT transform. Must be a power of 2
[in]qPrime modulus. Must satisfy \( q == 1 \mod 2N \)
[in]root_of_unity2N'th root of unity in \( \mathbb{Z_q} \).
[in]alloc_ptrCustom memory allocator used for intermediate calculations

Performs pre-computation necessary for forward and inverse transforms

template<class Allocator , class... AllocatorArgs>
hetest::utils::NTT::NTT ( uint64_t  degree,
uint64_t  q,
uint64_t  root_of_unity,
Allocator &&  a,
AllocatorArgs &&...  args 
)
inline

Member Function Documentation

void hetest::utils::NTT::ComputeForward ( uint64_t *  result,
const uint64_t *  operand,
uint64_t  input_mod_factor,
uint64_t  output_mod_factor 
)

Compute forward NTT. Results are bit-reversed.

Parameters
[out]resultStores the result
[in]operandData on which to compute the NTT
[in]input_mod_factorAssume input operand are in [0, input_mod_factor * q). Must be 1, 2 or 4.
[in]output_mod_factorReturns output operand in [0, output_mod_factor * q). Must be 1 or 4.
void hetest::utils::NTT::ComputeInverse ( uint64_t *  result,
const uint64_t *  operand,
uint64_t  input_mod_factor,
uint64_t  output_mod_factor 
)

Compute inverse NTT. Results are bit-reversed.

Parameters
[out]resultStores the result
[in]operandData on which to compute the NTT
[in]input_mod_factorAssume input operand are in [0, input_mod_factor * q). Must be 1 or 2.
[in]output_mod_factorReturns output operand in [0, output_mod_factor * q). Must be 1 or 2.

Member Data Documentation

std::shared_ptr<NTTImpl> hetest::utils::NTT::m_impl

Class implementing the NTT.


The documentation for this class was generated from the following files: