22.04.2014 Views

a590003

a590003

a590003

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

mod q l . A polynomial a ∈ A q is represented as the (l + 1) × φ(m) matrix of its evaluation at the<br />

roots of Φ 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 and multiplication in A q can be computed as component-wise addition and multiplication<br />

of 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 of 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 of 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 of four layers: in the bottom layer we have modules for<br />

implementing mathematical structures and various other utilities, the second layer implements<br />

our Double-CRT representation of polynomials, the third layer implements the cryptosystem itself<br />

(with the “native” plaintext space of binary polynomials), and the top layer provides interfaces<br />

for using the cryptosystem to operate on arrays of plaintext values (using the plaintext slots as<br />

described in Section 1.1). We think of the bottom two layers as the “math layers”, and the top<br />

two layers as the “crypto layers”, and describe then in detail in Sections 2 and 3, respectively.<br />

A block-diagram description of the library is given in Figure 1. Roughly, the modules NumbTh,<br />

timing, bluestein, PAlgebra, PAlgebraModTwo, PAlgebraMod2r, Cmodulus, IndexSet and IndexMap<br />

belong to the bottom layer, FHEcontext, SingleCRT and DoubleCRT belong to the second layer,<br />

FHE, Ctxt and KeySwitching are in the third layer, and EncryptedArray and 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 of the method(s) that<br />

we want to time and FHE TIMER STOP at the end, then the main program needs to call the function<br />

setTimersOn() to activate the timers and setTimersOff() to pause them. We can have at most<br />

one timer per method/function, and the timer is called by the same name as the function itself<br />

(using the pre-defiend variable func ). To obtain the value of a given timer (in seconds), the<br />

application can use the function double getTime4func(const char *fncName), and the function<br />

printAllTimers() prints the values of all timers to the standard output.<br />

2.2 NumbTh: Miscellaneous Utilities<br />

This module started out as an implementation of 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<br />

16. Design and Implementation of a Homomorphic-Encryption Library

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!