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.

(since the plaintext values can be elements in an extension field F 2 n), whereas class EncryptedArrayMod2r<br />

uses type vector for the same purpose (since the plaintext values in this case are<br />

integers). The methods that are provided are the following:<br />

// Fill the array with random plaintext data<br />

void random(vector& array) const; // EncryptedArray<br />

void random(vector& array) const; // EncryptedArrayMod2r<br />

// Encode the given array in a polynomial<br />

void encode(ZZX& ptxt, const vector& array) const;<br />

void encode(ZZX& ptxt, const vector& array) const;<br />

// Decode the given polynomial into an array of plaintext values<br />

void decode(vector& array, const ZZX& ptxt) const<br />

void decode(vector& array, const ZZX& ptxt) const<br />

// Multiply by the ciphertext by a polynomial encoding the given array<br />

void multByConst(Ctxt& ctxt, const vector& array);<br />

void multByConst(Ctxt& ctxt, const vector& array);<br />

// Add to the ciphertext a polynomial encoding the given array<br />

void addConst(Ctxt& ctxt, const vector& array)<br />

void addConst(Ctxt& ctxt, const vector& array)<br />

// MUX: for p=encode(selector), set c1 = c1*p + c2*(1-p)<br />

void select(Ctxt& c1, const Ctxt& c2, const vector& selector) const;<br />

void select(Ctxt& c1, const Ctxt& c2, const vector& selector) const;<br />

// Encode the array in a polynomial, then encrypt it in the ciphertext c<br />

void encrypt(Ctxt& c, const FHEPubKey& pKey, const vector& array) const;<br />

void encrypt(Ctxt& c, const FHEPubKey& pKey, const vector& array) const;<br />

// Decrypt the ciphertext c, then decode the result into the array<br />

void decrypt(const Ctxt& c, const FHESecKey& sKey, vector& array) const;<br />

void decrypt(const Ctxt& c, const FHESecKey& sKey, vector& array) const;<br />

5 Using the Library<br />

Below we provide two examples of how this library can be used by an application program. These<br />

examples compute a simple circuit with homomorphic arithmetic over either GF (2 8 ) (represented<br />

using the AES polynomial, G(X) = X 8 + X 4 + X 3 + X + 1), or over Z 2 5.<br />

33<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!