PKE Encoding documentation

Github Source: Encoding of plaintext into intermediate form

Page Contents

Interactions

graph BT A[Input Plaintext] --> |"1) Encode"| B(Encoded Plaintext); B(Encoded Plaintext) --> |"2) Encrypt"| C(Ciphertext); C(Ciphertext) --> |"3) Decrypt"| B(Encoded Plaintext); B(Encoded Plaintext) --> |"4) SetLength"| D(Homomorphically Transformed Plaintext);

File Listings

CKKS Packed Encoding (ckkspackedencoding.h)
  • Describes the CKKS packing. Accepts a std::vector<double> or a std::vector<std::complex> (although the double is recommended) unlike the other schemes.

Coef Packed Encoding (coefpackedencoding.h)
  • Packs integers into a vector of size n

  • Element-wise ops: Supports only element-wise addition (EvalAdd), but not multiplication. Thus, typically only works well when no multiplications are necessary

  • Scalar ops: multiplication supported

Note

Coef Packed Encoding is rarely used.

Encoding Params (encodingparams.h)
  • The object containing the parameters for encoding. These parameters are kept and continually reused (can be modified) during the encoding of new values

Encodings (encodings.h)
  • “import” file which can be used for a single #include

Packed Encoding (packedencoding.h)
  • Packs integers into a vector of size n

  • Supports element-wise addition and multiplication via EvalAdd and EvalMult respectively

  • Supports automorphisms (commonly known as rotations) via EvalAtIndex
    • Right Shift: positive index

    • Left Shift: negative index

    • Rotations work cyclically

Note

is almost always what you want to use (other than if you want to deal with floating numbers)

Plaintext (plaintext.h)
  • The base plaintext implementation

Plaintext Factory (plaintextfactory.h)
  • Factory class that instantiates plaintexts

String Encoding (stringencoding.h)
  • Encodes strings