Class LWESwitchingKeyImpl

Inheritance Relationships

Base Type

Class Documentation

class lbcrypto::LWESwitchingKeyImpl : public lbcrypto::Serializable

Inheritence diagram for lbcrypto::LWESwitchingKeyImpl:

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

Collaboration diagram for lbcrypto::LWESwitchingKeyImpl:

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

Class that stores the LWE scheme switching key.

Public Functions

LWESwitchingKeyImpl() = default
inline LWESwitchingKeyImpl(const std::vector<std::vector<std::vector<NativeVector>>> &keyA, const std::vector<std::vector<std::vector<NativeInteger>>> &keyB)

Constructs a key-switching key from its components

Both components are indexed [i][j - 1][k], where i is the position in the source (dimension-N) secret key skN, j in [1, baseKS) is the value of a base-baseKS digit and k is the digit position. The pair (keyA[i][j - 1][k], keyB[i][j - 1][k]) is an LWE encryption of skN[i] * j * baseKS^k under the target (dimension-n) secret key s modulo qKS, i.e. keyB = <keyA, s> + e + skN[i] * j * baseKS^k. For digit values j at or above the extent of the top digit position the innermost vectors have one entry fewer, since that position is never read during key switching.

Parameters
  • keyA – the vectors “a” of the key-switching LWE encryptions

  • keyB – the integers “b” of the key-switching LWE encryptions

inline LWESwitchingKeyImpl(std::vector<std::vector<std::vector<NativeVector>>> &&keyA, std::vector<std::vector<std::vector<NativeInteger>>> &&keyB) noexcept

Constructs a key-switching key from its components, moving them

Both components are indexed [i][j - 1][k], where i is the position in the source (dimension-N) secret key skN, j in [1, baseKS) is the value of a base-baseKS digit and k is the digit position. The pair (keyA[i][j - 1][k], keyB[i][j - 1][k]) is an LWE encryption of skN[i] * j * baseKS^k under the target (dimension-n) secret key s modulo qKS, i.e. keyB = <keyA, s> + e + skN[i] * j * baseKS^k. For digit values j at or above the extent of the top digit position the innermost vectors have one entry fewer, since that position is never read during key switching.

Parameters
  • keyA – the vectors “a” of the key-switching LWE encryptions

  • keyB – the integers “b” of the key-switching LWE encryptions

inline LWESwitchingKeyImpl(const LWESwitchingKeyImpl &rhs)
inline LWESwitchingKeyImpl(LWESwitchingKeyImpl &&rhs) noexcept
inline LWESwitchingKeyImpl &operator=(const LWESwitchingKeyImpl &rhs)
inline LWESwitchingKeyImpl &operator=(LWESwitchingKeyImpl &&rhs) noexcept
inline const std::vector<std::vector<std::vector<NativeVector>>> &GetElementsA() const
inline const std::vector<std::vector<std::vector<NativeInteger>>> &GetElementsB() const
inline void SetElementsA(const std::vector<std::vector<std::vector<NativeVector>>> &keyA)
inline void SetElementsB(const std::vector<std::vector<std::vector<NativeInteger>>> &keyB)
inline void SetElementsA(std::vector<std::vector<std::vector<NativeVector>>> &&keyA) noexcept
inline void SetElementsB(std::vector<std::vector<std::vector<NativeInteger>>> &&keyB) noexcept
inline bool operator==(const LWESwitchingKeyImpl &other) const
Parameters

other – the key-switching key to compare with

Returns

true if both keys have the same “a” vectors and “b” integers

inline bool operator!=(const LWESwitchingKeyImpl &other) const
Parameters

other – the key-switching key to compare with

Returns

true if the keys differ

template<class Archive>
inline void save(Archive &ar, std::uint32_t const version) const
template<class Archive>
inline void load(Archive &ar, std::uint32_t const version)
inline virtual std::string SerializedObjectName() const override

Returns the name identifying the derived class in serialized form; every serializable class provides it.

Returns

the serialized object name

Public Static Functions

static inline uint32_t SerializedVersion()