Template Class HELogicOperator< Scheme::CKKS >

Inheritance Relationships

Base Type

Class Documentation

template<>
class HELogicOperator<Scheme::CKKS> : private heongpu::HEOperator<Scheme::CKKS>

HELogicOperator performs homomorphic logical operations on ciphertexts.

Public Functions

HELogicOperator(HEContext<Scheme::CKKS> &context, HEEncoder<Scheme::CKKS> &encoder, double scale)

Constructs a new HELogicOperator object.

Parameters:
  • context – Encryption parameters.

  • encoder – Encoder for homomorphic operations.

inline void NOT(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Performs logical NOT on ciphertext.

Parameters:
  • input1 – First input ciphertext.

  • output – Output ciphertext.

  • options – Execution options.

inline void NOT_inplace(Ciphertext<Scheme::CKKS> &input1, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical NOT on ciphertext.

Parameters:
  • input1Ciphertext updated with result.

  • options – Execution options.

inline void AND(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs logical AND on two ciphertexts.

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • output – Output ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void AND_inplace(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical AND on two ciphertexts.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Second input ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void AND(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Performs logical AND on a ciphertext and a plaintext.

Parameters:
  • input1 – Input ciphertext.

  • input2 – Input plaintext.

  • output – Output ciphertext.

  • options – Execution options.

inline void AND_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical AND on a ciphertext and a plaintext.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Input plaintext.

  • options – Execution options.

inline void OR(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs logical OR on two ciphertexts.

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • output – Output ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void OR_inplace(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical OR on two ciphertexts.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Second input ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void OR(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Performs logical OR on a ciphertext and a plaintext.

Parameters:
  • input1 – Input ciphertext.

  • input2 – Input plaintext.

  • output – Output ciphertext.

  • options – Execution options.

inline void OR_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical OR on a ciphertext and a plaintext.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Input plaintext.

  • options – Execution options.

inline void XOR(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs logical XOR on two ciphertexts.

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • output – Output ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void XOR_inplace(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical XOR on two ciphertexts.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Second input ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void XOR(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Performs logical XOR on a ciphertext and a plaintext.

Parameters:
  • input1 – Input ciphertext.

  • input2 – Input plaintext.

  • output – Output ciphertext.

  • options – Execution options.

inline void XOR_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical XOR on a ciphertext and a plaintext.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Input plaintext.

  • options – Execution options.

inline void NAND(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs logical NAND on two ciphertexts.

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • output – Output ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void NAND_inplace(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical NAND on two ciphertexts.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Second input ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void NAND(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Performs logical NAND on a ciphertext and a plaintext.

Parameters:
  • input1 – Input ciphertext.

  • input2 – Input plaintext.

  • output – Output ciphertext.

  • options – Execution options.

inline void NAND_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical NAND on a ciphertext and a plaintext.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Input plaintext.

  • options – Execution options.

inline void NOR(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs logical NOR on two ciphertexts.

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • output – Output ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void NOR_inplace(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical NOR on two ciphertexts.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Second input ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void NOR(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Performs logical NOR on a ciphertext and a plaintext.

Parameters:
  • input1 – Input ciphertext.

  • input2 – Input plaintext.

  • output – Output ciphertext.

  • options – Execution options.

inline void NOR_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical NOR on a ciphertext and a plaintext.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Input plaintext.

  • options – Execution options.

inline void XNOR(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs logical XNOR on two ciphertexts.

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • output – Output ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void XNOR_inplace(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical XNOR on two ciphertexts.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Second input ciphertext.

  • relin_key – Relinearization key.

  • options – Execution options.

inline void XNOR(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Performs logical XNOR on a ciphertext and a plaintext.

Parameters:
  • input1 – Input ciphertext.

  • input2 – Input plaintext.

  • output – Output ciphertext.

  • options – Execution options.

inline void XNOR_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Performs in-place logical XNOR on a ciphertext and a plaintext.

Parameters:
  • input1Ciphertext updated with result.

  • input2 – Input plaintext.

  • options – Execution options.

void generate_bootstrapping_params(const double scale, const BootstrappingConfig &config, const logic_bootstrapping_type &boot_type)

Generates bootstrapping parameters.

Parameters:
  • scale – Scaling factor.

  • config – Bootstrapping configuration.

inline std::vector<int> bootstrapping_key_indexs()

Retrieves galois key indexes required for bootstrapping.

Throws:

std::invalid_argument – if parameters are not generated.

Returns:

std::vector<int> Bootstrapping key indexes.

Ciphertext<Scheme::CKKS> bit_bootstrapping(Ciphertext<Scheme::CKKS> &input1, Galoiskey<Scheme::CKKS> &galois_key, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs bit-level bootstrapping on a ciphertext.(For more detail please check README.md)

Parameters:
  • input1 – Input ciphertext.

  • galois_key – Galois key for rotations.

  • relin_key – Relinearization key.

  • options – Execution options.

Returns:

Ciphertext Bootstrapped ciphertext.

inline Ciphertext<Scheme::CKKS> AND_bootstrapping(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Galoiskey<Scheme::CKKS> &galois_key, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Bootstrapped logical AND gate.(For more detail please check README.md)

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • galois_key – Galois key for rotations.

  • relin_key – Relinearization key.

  • options – Execution options.

Returns:

Ciphertext Bootstrapped result.

inline Ciphertext<Scheme::CKKS> OR_bootstrapping(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Galoiskey<Scheme::CKKS> &galois_key, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Bootstrapped logical OR gate.(For more detail please check README.md)

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • galois_key – Galois key for rotations.

  • relin_key – Relinearization key.

  • options – Execution options.

Returns:

Ciphertext Bootstrapped result.

inline Ciphertext<Scheme::CKKS> XOR_bootstrapping(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Galoiskey<Scheme::CKKS> &galois_key, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Bootstrapped logical XOR gate.(For more detail please check README.md)

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • galois_key – Galois key for rotations.

  • relin_key – Relinearization key.

  • options – Execution options.

Returns:

Ciphertext Bootstrapped result.

inline Ciphertext<Scheme::CKKS> NAND_bootstrapping(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Galoiskey<Scheme::CKKS> &galois_key, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Bootstrapped logical NAND gate.(For more detail please check README.md)

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • galois_key – Galois key for rotations.

  • relin_key – Relinearization key.

  • options – Execution options.

Returns:

Ciphertext Bootstrapped result.

inline Ciphertext<Scheme::CKKS> NOR_bootstrapping(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Galoiskey<Scheme::CKKS> &galois_key, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Bootstrapped logical NOR gate.(For more detail please check README.md)

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • galois_key – Galois key for rotations.

  • relin_key – Relinearization key.

  • options – Execution options.

Returns:

Ciphertext Bootstrapped result.

inline Ciphertext<Scheme::CKKS> XNOR_bootstrapping(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Galoiskey<Scheme::CKKS> &galois_key, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Bootstrapped logical XNOR gate.(For more detail please check README.md)

Parameters:
  • input1 – First input ciphertext.

  • input2 – Second input ciphertext.

  • galois_key – Galois key for rotations.

  • relin_key – Relinearization key.

  • options – Execution options.

Returns:

Ciphertext Bootstrapped result.