Design and Implementation of a Homomorphic ... - Researcher
Design and Implementation of a Homomorphic ... - Researcher
Design and Implementation of a Homomorphic ... - Researcher
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
mod q l . A polynomial a ∈ A q is represented as the (l + 1) × φ(m) matrix <strong>of</strong> its evaluation at the<br />
roots <strong>of</strong> Φ m (X) modulo p i for i = 0, . . . , l:<br />
(<br />
)<br />
DoubleCRT l (a) = a(ζ j i ) mod p i<br />
.<br />
0≤i≤l, j∈Z ∗ m<br />
Addition <strong>and</strong> multiplication in A q can be computed as component-wise addition <strong>and</strong> multiplication<br />
<strong>of</strong> the entries in the two tables (modulo the appropriate primes p i ),<br />
DoubleCRT l (a + b) = DoubleCRT l (a) + DoubleCRT l (b),<br />
DoubleCRT l (a · b) = DoubleCRT l (a) · DoubleCRT l (b).<br />
Also, for an element <strong>of</strong> the Galois group κ ∈ Gal, mapping a(X) ∈ A to a(X k ) mod Φ m (X), we can<br />
evaluate κ(a) on the double-CRT representation <strong>of</strong> a just by permuting the columns in the matrix,<br />
sending each column j to column j · k mod m.<br />
1.3 Modules in our Library<br />
Very roughly, our HE library consists <strong>of</strong> four layers: in the bottom layer we have modules for<br />
implementing mathematical structures <strong>and</strong> various other utilities, the second layer implements<br />
our Double-CRT representation <strong>of</strong> polynomials, the third layer implements the cryptosystem itself<br />
(with the “native” plaintext space <strong>of</strong> binary polynomials), <strong>and</strong> the top layer provides interfaces<br />
for using the cryptosystem to operate on arrays <strong>of</strong> plaintext values (using the plaintext slots as<br />
described in Section 1.1). We think <strong>of</strong> the bottom two layers as the “math layers”, <strong>and</strong> the top<br />
two layers as the “crypto layers”, <strong>and</strong> describe then in detail in Sections 2 <strong>and</strong> 3, respectively.<br />
A block-diagram description <strong>of</strong> the library is given in Figure 1. Roughly, the modules NumbTh,<br />
timing, bluestein, PAlgebra, PAlgebraModTwo, PAlgebraMod2r, Cmodulus, IndexSet <strong>and</strong> IndexMap<br />
belong to the bottom layer, FHEcontext, SingleCRT <strong>and</strong> DoubleCRT belong to the second layer,<br />
FHE, Ctxt <strong>and</strong> KeySwitching are in the third layer, <strong>and</strong> EncryptedArray <strong>and</strong> EncryptedArrayMod2r<br />
are in the top layer.<br />
2 The Math Layers<br />
2.1 The timing module<br />
This module contains some utility function for measuring the time that various methods take to<br />
execute. To use it, we insert the macro FHE TIMER START at the beginning <strong>of</strong> the method(s) that<br />
we want to time <strong>and</strong> FHE TIMER STOP at the end, then the main program needs to call the function<br />
setTimersOn() to activate the timers <strong>and</strong> setTimersOff() to pause them. We can have at most<br />
one timer per method/function, <strong>and</strong> the timer is called by the same name as the function itself<br />
(using the pre-defiend variable func ). To obtain the value <strong>of</strong> a given timer (in seconds), the<br />
application can use the function double getTime4func(const char *fncName), <strong>and</strong> the function<br />
printAllTimers() prints the values <strong>of</strong> all timers to the st<strong>and</strong>ard output.<br />
2.2 NumbTh: Miscellaneous Utilities<br />
This module started out as an implementation <strong>of</strong> some number-theoretic algorithms (hence the<br />
name), but since then it grew to include many different little utility functions. For example, CRT-<br />
3