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.

variable s(τ m ) (defined over the choice <strong>of</strong> each <strong>of</strong> these coefficients as ±1) is a zero-mean complex<br />

r<strong>and</strong>om variable with variance exactly H (since it is a sum <strong>of</strong> exactly H r<strong>and</strong>om variables, each<br />

obtained by multiplying a uniform ±1 by a complex constant <strong>of</strong> magnitude 1). For r > 1, it is<br />

clear that E[|s(τ m ) r | 2 ] ≥ E[|s(τ m )| 2 ] r = H r , but the factor <strong>of</strong> r! may not be clear. We obtained that<br />

factor experimentally for the most part, by generating many polynomials s <strong>of</strong> some given Hamming<br />

weight <strong>and</strong> checking the magnitude <strong>of</strong> s(τ m ). Then we validated this experimental result the case<br />

r = 2 (which is the most common case when using our library), as described in the appendix. The<br />

rules that we use for computing <strong>and</strong> updating the data member noiseVar during the computation,<br />

as described below.<br />

Encryption. For a fresh ciphertext, encrypted using the public encryption key, we have noiseVar =<br />

σ 2 (1 + φ(m) 2 /2 + φ(m)(H + 1)), where σ 2 is the variance in our RLWE instances, <strong>and</strong> H is<br />

the Hamming weight <strong>of</strong> the first secret key.<br />

When the plaintext space modulus is p > 2, that quantity is larger by a factor <strong>of</strong> p 2 . See<br />

Section 3.2.2 for the reason for these expressions.<br />

Modulus-switching. The noise magnitude in the ciphertexts scales up as we add primes to the<br />

prime-set, while modulus-switching down involves both scaling down <strong>and</strong> adding some term<br />

(corresponding to the rounding errors for modulus-switching). Namely, when adding more<br />

primes to the prime-set we scale up the noise estimate as noiseVar ′ = noiseVar · ∆ 2 , with<br />

∆ the product <strong>of</strong> the added primes.<br />

When removing primes from the prime-set we scale down <strong>and</strong> add an extra term, setting<br />

noiseVar ′ = noiseVar/∆ 2 +addedNoise, where the added-noise term is computed as follows:<br />

We go over all the parts in the ciphertext, <strong>and</strong> consider their h<strong>and</strong>les. For any part j with a<br />

h<strong>and</strong>le that points to s r j<br />

j<br />

(X t j<br />

), where s j is a secret-key polynomial whose coefficient vector<br />

has Hamming-weight H j , we add a term (p 2 /12) · φ(m) · (r j )! · H r j<br />

j<br />

. Namely, when modulusswitching<br />

down we set<br />

noiseVar ′ = noiseVar/∆ 2 + ∑ j<br />

See Section 3.1.5 for the reason for this expression.<br />

p 2<br />

12 · φ(m) · (r j)! · H r j<br />

j<br />

.<br />

Re-linearization/key-switching. When key-switching a ciphertext, we modulus-switch down to<br />

remove all the “special primes” from the prime-set <strong>of</strong> the ciphertext if needed (cf. Section 2.7).<br />

Then, the key-switching operation itself has the side-effect <strong>of</strong> adding these “special primes”<br />

back. These two modulus-switching operations have the effect <strong>of</strong> scaling the noise down, then<br />

back up, with the added noise term as above. Then add yet another noise term as follows:<br />

The key-switching operation involves breaking the ciphertext into some number n ′ <strong>of</strong> “digits”<br />

(see Section 3.1.6). For each digit i <strong>of</strong> size D i <strong>and</strong> every ciphertext-part that we need to<br />

switch (i.e., one that does not already point to 1 or a base secret key), we add a noise-term<br />

φ(m)σ 2 · p 2 · D 2 i /4, where σ2 is the variance in our RLWE instances. Namely, if we need to<br />

switch k parts <strong>and</strong> if noiseVar ′ is the noise estimate after the modulus-switching down <strong>and</strong><br />

up as above, then our final noise estimate after key-switching is<br />

∑<br />

noiseVar ′′ = noiseVar ′ + k · φ(m)σ 2 · p 2 · Di 2 /4<br />

17<br />

n ′<br />

i=1

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

Saved successfully!

Ooh no, something went wrong!