HElib 1.0 Implementing Homomorphic Encryption

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Files Functions Variables Friends Pages
Public Member Functions | List of all members
EncryptedArrayBase Class Referenceabstract

virtual class for data-movement operations on arrays of slots More...

`#include <EncryptedArray.h>`

Inheritance diagram for EncryptedArrayBase:

## Public Member Functions
virtual EncryptedArrayBase * | clone () const =0
virtual const FHEcontext & | getContext () const =0
virtual const long | getDegree () const =0
virtual void | rotate (Ctxt &ctxt, long k) const =0
| Rotation/shift as a linear array.
virtual void | shift (Ctxt &ctxt, long k) const =0
| Non-cyclic shift with zero fill.
virtual void | rotate1D (Ctxt &ctxt, long i, long k, bool dc=false) const =0
| rotate k positions along the i'th dimension More...
virtual void | shift1D (Ctxt &ctxt, long i, long k) const =0
| Shift k positions along the i'th dimension with zero fill.
virtual void | buildLinPolyCoeffs (vector< ZZX > &C, const vector< ZZX > &L) const =0
| Linearized polynomials. L describes a linear map M by describing its action on the standard power basis: M(x^j mod G) = (L[j] mod G), for j = 0..d-1. The result is a coefficient vector C for the linearized polynomial representing M: for h in Z/(p^r)[X] of degree < d,. More...
long | size () const
| Total size (# of slots) of hypercube.
long | dimension () const
| Number of dimensions of hypercube.
long | sizeOfDimension (long i) const
| Size of given dimension.
long | nativeDimension (long i) const
| Is rotations in given dimension a "native" operation?
long | coordinate (long i, long k) const
| returns coordinate of index k along the i'th dimension
Encoding/decoding methods
virtual void | encode (ZZX &ptxt, const vector< long > &array) const =0
virtual void | encode (ZZX &ptxt, const vector< ZZX > &array) const =0
virtual void | encode (ZZX &ptxt, const PlaintextArray &array) const =0
virtual void | decode (vector< long > &array, const ZZX &ptxt) const =0
virtual void | decode (vector< ZZX > &array, const ZZX &ptxt) const =0
virtual void | decode (PlaintextArray &array, const ZZX &ptxt) const =0
virtual void | encodeUnitSelector (ZZX &ptxt, long i) const =0
| Encodes a vector with 1 at position i and 0 everywhere else.
Encoding+encryption/decryption+decoding
virtual void | encrypt (Ctxt &ctxt, const FHEPubKey &pKey, const vector< long > &ptxt) const =0
virtual void | encrypt (Ctxt &ctxt, const FHEPubKey &pKey, const vector< ZZX > &ptxt) const =0
virtual void | encrypt (Ctxt &ctxt, const FHEPubKey &pKey, const PlaintextArray &ptxt) const =0
virtual void | decrypt (const Ctxt &ctxt, const FHESecKey &sKey, vector< long > &ptxt) const =0
virtual void | decrypt (const Ctxt &ctxt, const FHESecKey &sKey, vector< ZZX > &ptxt) const =0
virtual void | decrypt (const Ctxt &ctxt, const FHESecKey &sKey, PlaintextArray &ptxt) const =0
virtual void | select (Ctxt &ctxt1, const Ctxt &ctxt2, const vector< long > &selector) const =0
| MUX: ctxt1 = ctxt1*selector + ctxt2*(1-selector)
virtual void | select (Ctxt &ctxt1, const Ctxt &ctxt2, const vector< ZZX > &selector) const =0
virtual void | select (Ctxt &ctxt1, const Ctxt &ctxt2, const PlaintextArray &selector) const =0

## Detailed Description

virtual class for data-movement operations on arrays of slots

An object ea of type EncryptedArray stores information about an FHEcontext context, and a monic polynomial G. If context defines parameters m, p, and r, then ea is a helper abject that supports encoding/decoding and encryption/decryption of vectors of plaintext slots over the ring (Z/(p^r)[X])/(G).

The polynomial G should be irreducble over Z/(p^r) (this is not checked). The degree of G should divide the multiplicative order of p modulo m (this is checked). Currently, the following restriction is imposed:

either r == 1 or deg(G) == 1 or G == factors[0].

ea stores objects in the polynomial the polynomial ring Z/(p^r)[X].

Just as for the class PAlegebraMod, if p == 2 and r == 1, then these polynomials are represented as GF2X's, and otherwise as zz_pX's. Thus, the types of these objects are not determined until run time. As such, we need to use a class heirarchy, which mirrors that of PAlgebraMod, as follows.

EncryptedArrayBase is a virtual class

EncryptedArrayDerived<type> is a derived template class, where type is either PA_GF2 or PA_zz_p.

The class EncryptedArray is a simple wrapper around a smart pointer to an EncryptedArrayBase object: copying an EncryptedArray object results is a "deep copy" of the underlying object of the derived class.

## Member Function Documentation

virtual void EncryptedArrayBase::buildLinPolyCoeffs | ( | vector< ZZX > & | C,
|  | const vector< ZZX > & | L
| ) |  | const
| pure virtual

Linearized polynomials. L describes a linear map M by describing its action on the standard power basis: M(x^j mod G) = (L[j] mod G), for j = 0..d-1. The result is a coefficient vector C for the linearized polynomial representing M: for h in Z/(p^r)[X] of degree < d,.

M(h(X) mod G) = sum_{i=0}^{d-1} (C[j] mod G) * (h(X^{p^j}) mod G).

Implemented in EncryptedArrayDerived< type >.

virtual void EncryptedArrayBase::rotate1D | ( | Ctxt & | ctxt,
|  | long | i,
|  | long | k,
|  | bool | dc = `false`
| ) |  | const
| pure virtual

rotate k positions along the i'th dimension

Parameters

  dc | means "don't care", which means that the caller guarantees that only zero elements rotate off the end – this allows for some optimizations that would not otherwise be possible

Implemented in EncryptedArrayDerived< type >.

The documentation for this class was generated from the following file:

- src/EncryptedArray.h