Performs negacyclic forward and inverse number-theoretic transform (NTT), commonly used in RLWE cryptography.
More...
#include <ntt.hpp>
|
| | 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) |
| |
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) \).
| 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] | degree | also known as N. Size of the NTT transform. Must be a power of 2 |
| [in] | q | Prime modulus. Must satisfy \( q == 1 \mod 2N \) |
| [in] | alloc_ptr | Custom 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] | degree | also known as N. Size of the NTT transform. Must be a power of 2 |
| [in] | q | Prime modulus. Must satisfy \( q == 1 \mod 2N \) |
| [in] | root_of_unity | 2N'th root of unity in \( \mathbb{Z_q} \). |
| [in] | alloc_ptr | Custom 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 |
| 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] | result | Stores the result |
| [in] | operand | Data on which to compute the NTT |
| [in] | input_mod_factor | Assume input operand are in [0, input_mod_factor * q). Must be 1, 2 or 4. |
| [in] | output_mod_factor | Returns 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] | result | Stores the result |
| [in] | operand | Data on which to compute the NTT |
| [in] | input_mod_factor | Assume input operand are in [0, input_mod_factor * q). Must be 1 or 2. |
| [in] | output_mod_factor | Returns output operand in [0, output_mod_factor * q). Must be 1 or 2. |
| std::shared_ptr<NTTImpl> hetest::utils::NTT::m_impl |
Class implementing the NTT.
The documentation for this class was generated from the following files: