08.01.2015 Views

Design and Implementation of a Homomorphic ... - Researcher

Design and Implementation of a Homomorphic ... - Researcher

Design and Implementation of a Homomorphic ... - Researcher

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

g i ’s <strong>and</strong> h i ’s in one list, let us denote the generators <strong>of</strong> Z ∗ m/ 〈2〉 by {f 1 , f 2 , . . . , f n }, <strong>and</strong> let ord(f i )<br />

be the order <strong>of</strong> f i in the quotient group at the time that it was added to the list <strong>of</strong> generators. The<br />

the slot-index representative set is<br />

}<br />

T<br />

def =<br />

{ n<br />

∏<br />

i=1<br />

f e i<br />

i<br />

mod m : ∀i, e i ∈ {0, 1, . . . , ord(f i ) − 1}<br />

Clearly, we have T ⊂ Z ∗ m, <strong>and</strong> moreover T contains exactly one representative from each equivalence<br />

class <strong>of</strong> Z ∗ m/ 〈2〉. Recall that we use these representatives in our encoding <strong>of</strong> plaintext slots, where<br />

a polynomial a ∈ A 2 is viewed as encoding the vector <strong>of</strong> F 2 d elements ( a(ρ t ) ∈ F 2 d : t ∈ T ) , where<br />

ρ is some fixed primitive m-th root <strong>of</strong> unity in F 2 d.<br />

In addition to defining the sets <strong>of</strong> generators <strong>and</strong> representatives, the class PAlgebra also provides<br />

translation methods between representations, specifically:<br />

int ith rep(unsigned i) const;<br />

Returns t i , i.e., the i’th representative from T .<br />

int indexOfRep(unsigned t) const;<br />

Returns the index i such that ith rep(i) = t.<br />

int exponentiate(const vector& exps, bool onlySameOrd=false) const;<br />

Takes a vector <strong>of</strong> exponents, (e 1 , . . . , e n ) <strong>and</strong> returns t = ∏ n<br />

i=1 f e i<br />

i<br />

∈ T .<br />

const int* dLog(unsigned t) const;<br />

On input some t ∈ T , returns the discrete-logarithm <strong>of</strong> t with the f i ’s are bases. Namely, a<br />

vector exps= (e 1 , . . . , e n ) such that exponentiate(exps)= t, <strong>and</strong> moreover 0 ≤ e i ≤ ord(f i )<br />

for all i.<br />

2.5 PAlgebraModTwo/PAlgebraMod2r: Plaintext Slots<br />

These two classes implements the structure <strong>of</strong> the plaintext spaces, either A 2 = A/2A (when using<br />

mod-2 arithmetic for the plaintext space) or A 2 r = A/2 r A (when using mod-2 r arithmetic, for<br />

some small vale <strong>of</strong> r, e.g. mod-128 arithmetic). We typically use the mod-2 arithmetic for real<br />

computation, but we expect to use the mod-2 r arithmetic for bootstrapping, as described in [6].<br />

Below we cover the mod-2 case first, then extend it to mod-2 r .<br />

For the mod-2 case, the plaintext slots are determined by the factorization <strong>of</strong> Φ m (X) modulo 2<br />

into l degree-d polynomials. Once we have that factorization, Φ m (X) = ∏ j F j(X) (mod 2), we<br />

choose an arbitrary factor as the “first factor”, denote it F 1 (X), <strong>and</strong> this corresponds to the first<br />

input slot (whose representative is 1 ∈ T ). With each representative t ∈ T we then associate<br />

the factor GCD(F 1 (X t ), Φ m (X)), with polynomial-GCD computed modulo 2. Note that fixing a<br />

representation <strong>of</strong> the field K = Z 2 [X]/F 1 (X) ∼ = F 2 d <strong>and</strong> letting ρ be a root <strong>of</strong> F 1 in K, we get that<br />

the factor associated with the representative t is the minimal polynomial <strong>of</strong> ρ 1/t . Yet another way<br />

<strong>of</strong> saying the same thing, if the roots <strong>of</strong> F 1 in K are ρ, ρ 2 , ρ 4 , . . . , ρ 2d−1 then the roots <strong>of</strong> the factor<br />

associated to t are ρ 1/t , ρ 2/t , ρ 4/t , . . . , ρ 2d−1 /t , where the arithmetic in the exponent is modulo m.<br />

After computing the factors <strong>of</strong> Φ m (X) modulo 2 <strong>and</strong> the correspondence between these factors<br />

<strong>and</strong> the representatives from T , the class PAlgebraModTwo provide encoding/decoding methods to<br />

pack elements in polynomials <strong>and</strong> unpack them back. Specifically we have the following methods:<br />

.<br />

6

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

Saved successfully!

Ooh no, something went wrong!