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

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

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

with ˜c 2 = [ ∑ j c′′ j ] qQ ∗<br />

˜c 2 + ˜c 1 s j =<br />

<strong>and</strong> ˜c 1 = [ ∑ j c′ j ] qQ∗, <strong>and</strong> we have<br />

⎛<br />

⎝ ∑ j<br />

⎞<br />

c j s ′ ⎠<br />

j + p ( ∑ ) ( ∑ )<br />

e i c i,j = m + p e i c i,j<br />

i,j<br />

i,j<br />

(mod qQ ∗ ).<br />

Hence, as long as the additive term p( ∑ i,j e ic i,j ) is small enough, decrypting the new ciphertext<br />

yields the same plaintext value modulo p as decrypting the original ciphertext ⃗c.<br />

In terms <strong>of</strong> noise magnitude, we first scale up the noise by a factor <strong>of</strong> Q ∗ when adding all the<br />

special primes, <strong>and</strong> then add the extra noise term p · ∑i,j e ic i,j . Since the c i,j ’s have coefficients <strong>of</strong><br />

magnitude at most D i /2 <strong>and</strong> the polynomials e i are RLWE error terms with zero-mean coefficients<br />

<strong>and</strong> variance σ 2 , then the second moment <strong>of</strong> e i (τ m ) · c i,j (τ m ) is no more than φ(m)σ 2 · Di 2 /4. Thus<br />

for every ciphertext part that we need to switch (i.e. that has a h<strong>and</strong>le that points to something<br />

other than 1 or base), we add a term <strong>of</strong> φ(m)σ 2 · p 2 · Di 2 /4. Therefore, if our noise estimate after<br />

the scale-up is noiseVar ′ <strong>and</strong> we need to switch k<br />

3.1.7 Native arithmetic operations<br />

∑<br />

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

The native arithmetic operations that can be performed on ciphertexts are negation, addition/subtraction,<br />

multiplication, addition <strong>of</strong> constants, multiplication by constant, <strong>and</strong> automorphism. In our library<br />

we expose to the application both the operations in their “raw form” without any additional<br />

modulus- or key-switching, as well as some higher-level interfaces for multiplication <strong>and</strong> automorphisms<br />

that include also modulus- <strong>and</strong> key-switching.<br />

Negation. The method Ctxt::negate() transforms an encryption <strong>of</strong> a polynomial m ∈ A p to<br />

an encryption <strong>of</strong> [−m] p , simply by negating all the ciphertext parts modulo the current modulus.<br />

(Of course this has an effect on the plaintext only when p > 2.) The noise estimate is unaffected.<br />

Addition/subtraction. Both <strong>of</strong> these operations are implemented by the single method<br />

void Ctxt::addCtxt(const Ctxt& other, bool negative=false);<br />

depending on the negative boolean flag. For convenience, we provide the methods Ctxt::operator+=<br />

<strong>and</strong> Ctxt::operator-= that call addCtxt with the appropriate flag. A side effect <strong>of</strong> this operation<br />

is that the prime-set <strong>of</strong> *this is set to the union <strong>of</strong> the prime sets <strong>of</strong> both ciphertexts. After this<br />

scaling (if needed), every ciphertext-part in other that has a matching part in *this (i.e. a part<br />

with the same h<strong>and</strong>le) is added to this matching part, <strong>and</strong> any part in other without a match is<br />

just appended to *this. We also add the noise estimate <strong>of</strong> both ciphertexts.<br />

Constant addition. Implemented by the methods<br />

void Ctxt::addConstant(const ZZX& poly, double size=0.0);<br />

void Ctxt::addConstant(const DoubleCRT& poly, double size=0.0);<br />

The constant is scaled by a factor f = (q mod p), with q the current modulus <strong>and</strong> p the ciphertext<br />

modulus (to maintain our invariant that a ciphertext relative to q has this extra factor), then added<br />

to the part <strong>of</strong> *this that points to 1. The calling application can specify the size <strong>of</strong> the added<br />

21<br />

n ′<br />

i=1

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

Saved successfully!

Ooh no, something went wrong!