Class LeveledSHERNS

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class lbcrypto::LeveledSHERNS : public lbcrypto::LeveledSHEBase<DCRTPoly>

Inheritence diagram for lbcrypto::LeveledSHERNS:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="lbcrypto::LeveledSHEBase< DCRTPoly >" tooltip="lbcrypto::LeveledSHEBase< DCRTPoly >"] "3" [label="lbcrypto::LeveledSHEBFVRNS" tooltip="lbcrypto::LeveledSHEBFVRNS"] "5" [label="lbcrypto::LeveledSHECKKSRNS" tooltip="lbcrypto::LeveledSHECKKSRNS"] "4" [label="lbcrypto::LeveledSHEBGVRNS" tooltip="lbcrypto::LeveledSHEBGVRNS"] "1" [label="lbcrypto::LeveledSHERNS" tooltip="lbcrypto::LeveledSHERNS" fillcolor="#BFBFBF"] "3" -> "1" [dir=forward tooltip="public-inheritance"] "5" -> "1" [dir=forward tooltip="public-inheritance"] "4" -> "1" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for lbcrypto::LeveledSHERNS:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="lbcrypto::LeveledSHEBase< DCRTPoly >" tooltip="lbcrypto::LeveledSHEBase< DCRTPoly >"] "1" [label="lbcrypto::LeveledSHERNS" tooltip="lbcrypto::LeveledSHERNS" fillcolor="#BFBFBF"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Abstract interface class for LBC SHE algorithms.

Template Parameters

Element – a ring element.

Subclassed by lbcrypto::LeveledSHEBFVRNS, lbcrypto::LeveledSHEBGVRNS, lbcrypto::LeveledSHECKKSRNS

Public Functions

inline virtual ~LeveledSHERNS()
Ciphertext<DCRTPoly> EvalAdd(ConstCiphertext<DCRTPoly> ciphertext1, ConstCiphertext<DCRTPoly> ciphertext2) const override

Virtual function to define the interface for homomorphic addition of ciphertexts.

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

Returns

the new ciphertext.

void EvalAddInPlace(Ciphertext<DCRTPoly> &ciphertext1, ConstCiphertext<DCRTPoly> ciphertext2) const override

Virtual function to define the interface for in-place homomorphic addition of ciphertexts.

Parameters
  • ciphertext1 – the input/output ciphertext.

  • ciphertext2 – the input ciphertext.

virtual Ciphertext<DCRTPoly> EvalAddMutable(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override

Virtual function to define the interface for homomorphic addition of ciphertexts. This is the mutable version - input ciphertexts may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

Returns

the new ciphertext.

virtual void EvalAddMutableInPlace(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override
Ciphertext<DCRTPoly> EvalAdd(ConstCiphertext<DCRTPoly> ciphertext, ConstPlaintext plaintext) const override

Virtual function to define the interface for homomorphic addition of ciphertexts.

Parameters
  • ciphertext – the input ciphertext.

  • plaintext – the input plaintext.

Returns

the new ciphertext.

void EvalAddInPlace(Ciphertext<DCRTPoly> &ciphertext, ConstPlaintext plaintext) const override

Virtual function to define the interface for homomorphic addition of ciphertexts.

Parameters
  • ciphertext – the input ciphertext.

  • plaintext – the input plaintext.

virtual Ciphertext<DCRTPoly> EvalAddMutable(Ciphertext<DCRTPoly> &ciphertext, Plaintext plaintext) const override

Virtual function to define the interface for homomorphic addition of ciphertexts. This is the mutable version - input ciphertext may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext – the input ciphertext.

  • plaintext – the input plaintext.

Returns

the new ciphertext.

virtual void EvalAddMutableInPlace(Ciphertext<DCRTPoly> &ciphertext, Plaintext plaintext) const override

Virtual function to define the interface for homomorphic addition of ciphertexts. This is the mutable version - input ciphertext may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext – the input ciphertext.

  • plaintext – the input plaintext.

Returns

the new ciphertext.

Ciphertext<DCRTPoly> EvalSub(ConstCiphertext<DCRTPoly> ciphertext1, ConstCiphertext<DCRTPoly> ciphertext2) const override

Virtual function to define the interface for homomorphic subtraction of ciphertexts.

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

Returns

the new ciphertext.

void EvalSubInPlace(Ciphertext<DCRTPoly> &ciphertext1, ConstCiphertext<DCRTPoly> ciphertext2) const override

Virtual function to define the interface for homomorphic subtraction of ciphertexts.

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

virtual Ciphertext<DCRTPoly> EvalSubMutable(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override

Virtual function to define the interface for homomorphic subtraction of ciphertexts. This is the mutable version - input ciphertext may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

Returns

the new ciphertext.

virtual void EvalSubMutableInPlace(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override

Virtual function to define the interface for homomorphic subtraction of ciphertexts. This is the mutable version - input ciphertext may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

Returns

the new ciphertext.

Ciphertext<DCRTPoly> EvalSub(ConstCiphertext<DCRTPoly> ciphertext, ConstPlaintext plaintext) const override

Virtual function to define the interface for homomorphic subtraction of ciphertexts.

Parameters
  • ciphertext – the input ciphertext.

  • plaintext – the input plaintext.

Returns

the new ciphertext.

void EvalSubInPlace(Ciphertext<DCRTPoly> &ciphertext, ConstPlaintext plaintext) const override
virtual Ciphertext<DCRTPoly> EvalSubMutable(Ciphertext<DCRTPoly> &ciphertext, Plaintext plaintext) const override

Virtual function to define the interface for homomorphic subtraction of ciphertexts. This is the mutable version - input ciphertext may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext – the input ciphertext.

  • plaintext – the input plaintext.

Returns

the new ciphertext.

virtual void EvalSubMutableInPlace(Ciphertext<DCRTPoly> &ciphertext, Plaintext plaintext) const override

Virtual function to define the interface for homomorphic subtraction of ciphertexts. This is the mutable version - input ciphertext may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext – the input ciphertext.

  • plaintext – the input plaintext.

Returns

the new ciphertext.

virtual Ciphertext<DCRTPoly> EvalMult(ConstCiphertext<DCRTPoly> ciphertext1, ConstCiphertext<DCRTPoly> ciphertext2) const override

Virtual function to define the interface for multiplicative homomorphic evaluation of ciphertext.

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

Returns

the new ciphertext.

virtual Ciphertext<DCRTPoly> EvalMultMutable(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override

Virtual function to define the interface for multiplicative homomorphic evaluation of ciphertext. This is the mutable version - input ciphertexts may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

Returns

the new ciphertext.

virtual Ciphertext<DCRTPoly> EvalSquare(ConstCiphertext<DCRTPoly> ciphertext) const override

Virtual function to define the interface for multiplicative homomorphic evaluation of ciphertext.

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

Returns

the new ciphertext.

virtual Ciphertext<DCRTPoly> EvalSquareMutable(Ciphertext<DCRTPoly> &ciphertext) const override

Virtual function to define the interface for multiplicative homomorphic evaluation of ciphertext. This is the mutable version - input ciphertexts may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext1 – the input ciphertext.

  • ciphertext2 – the input ciphertext.

Returns

the new ciphertext.

Ciphertext<DCRTPoly> EvalMult(ConstCiphertext<DCRTPoly> ciphertext, ConstPlaintext plaintext) const override
void EvalMultInPlace(Ciphertext<DCRTPoly> &ciphertext, ConstPlaintext plaintext) const override
virtual Ciphertext<DCRTPoly> EvalMultMutable(Ciphertext<DCRTPoly> &ciphertext, Plaintext plaintext) const override

Virtual function to define the interface for multiplication of ciphertext by plaintext. This is the mutable version - input ciphertext may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext – the input ciphertext.

  • plaintext – the input plaintext.

Returns

the new ciphertext.

virtual void EvalMultMutableInPlace(Ciphertext<DCRTPoly> &ciphertext, Plaintext plaintext) const override

Virtual function to define the interface for multiplication of ciphertext by plaintext. This is the mutable version - input ciphertext may change (automatically rescaled, or towers dropped).

Parameters
  • ciphertext – the input ciphertext.

  • plaintext – the input plaintext.

Returns

the new ciphertext.

virtual Ciphertext<DCRTPoly> MultByMonomial(ConstCiphertext<DCRTPoly> ciphertext, usint power) const override
virtual void MultByMonomialInPlace(Ciphertext<DCRTPoly> &ciphertext, usint power) const override
virtual Ciphertext<DCRTPoly> ModReduce(ConstCiphertext<DCRTPoly> ciphertext, size_t levels) const override

Method for Modulus Reduction.

Parameters
  • &cipherText – Ciphertext to perform mod reduce on.

  • levels – the number of towers to drop.

virtual void ModReduceInPlace(Ciphertext<DCRTPoly> &ciphertext, size_t levels) const override

Method for In-place Modulus Reduction.

Parameters
  • &cipherText – Ciphertext to perform mod reduce on.

  • levels – the number of towers to drop.

Ciphertext<DCRTPoly> LevelReduce(ConstCiphertext<DCRTPoly> ciphertext, const EvalKey<DCRTPoly> evalKey, size_t levels) const override
virtual void LevelReduceInPlace(Ciphertext<DCRTPoly> &ciphertext, const EvalKey<DCRTPoly> evalKey, size_t levels) const override

Method for Level Reduction from sk -> sk1. This method peforms a keyswitch on the ciphertext and then performs a modulus reduction.

Parameters
  • &cipherText1 – is the original ciphertext to be key switched and mod reduced.

  • &linearKeySwitchHint – is the linear key switch hint to perform the key switch operation.

  • &cipherTextResult – is the resulting ciphertext.

virtual Ciphertext<DCRTPoly> Compress(ConstCiphertext<DCRTPoly> ciphertext, size_t towersLeft) const override

Protected Functions

virtual Ciphertext<DCRTPoly> ModReduceInternal(ConstCiphertext<DCRTPoly> ciphertext, size_t levels) const override

Method for rescaling.

Parameters
  • cipherText – is the ciphertext to perform modreduce on.

  • levels – the number of towers to drop.

Returns

ciphertext after the modulus reduction performed.

inline virtual void ModReduceInternalInPlace(Ciphertext<DCRTPoly> &ciphertext, size_t levels) const override

Method for rescaling in-place.

cipherText will have modulus reduction performed in-place.

Parameters
  • cipherText – is the ciphertext to perform modreduce on.

  • levels – the number of towers to drop.

virtual Ciphertext<DCRTPoly> LevelReduceInternal(ConstCiphertext<DCRTPoly> ciphertext, size_t levels) const override

Method for Level Reduction in the CKKS scheme. It just drops “levels” number of the towers of the ciphertext without changing the underlying plaintext.

Parameters
  • cipherText1 – is the original ciphertext to be level reduced.

  • levels – the number of towers to drop.

Returns

resulting ciphertext.

inline virtual void LevelReduceInternalInPlace(Ciphertext<DCRTPoly> &ciphertext, size_t levels) const override

Method for in-place Level Reduction in the CKKS scheme. It just drops “levels” number of the towers of the ciphertext without changing the underlying plaintext.

Parameters
  • cipherText1 – is the ciphertext to be level reduced in-place

  • linearKeySwitchHint – not used in the CKKS scheme.

  • levels – the number of towers to drop.

virtual void AdjustLevelsInPlace(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override
virtual void AdjustForAddOrSubInPlace(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override
virtual void AdjustForMultInPlace(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override
template<class Archive>
inline void save(Archive &ar) const
template<class Archive>
inline void load(Archive &ar)
inline std::string SerializedObjectName() const