29 #ifndef CIPHERTEXT_BASE_IMPLEMENTATION_GUARD
30 #define CIPHERTEXT_BASE_IMPLEMENTATION_GUARD
37 template <
typename T_CiphertextImpl>
45 template <
typename T_CiphertextImpl>
54 template <
typename T_CiphertextImpl>
62 template <
typename T_CiphertextImpl>
64 if (!this->encryptionModulus) {
65 throw std::runtime_error(
"This operation requires the encryption modulus.");
68 T_CiphertextImpl output(this->data.GetInverseModN(*this->encryptionModulus), this->encryptionModulus);
78 template <
typename T_CiphertextImpl>
80 if (!this->encryptionModulus) {
81 throw std::runtime_error(
"This operation requires the encryption modulus.");
84 T_CiphertextImpl output((this->data * input.data) % (*this->encryptionModulus), this->encryptionModulus);
94 template <
typename T_CiphertextImpl>
96 if (!this->encryptionModulus) {
97 throw std::runtime_error(
"This operation requires the encryption modulus.");
100 T_CiphertextImpl output((this->data * input.data.GetInverseModN(*this->encryptionModulus)) % (*this->encryptionModulus), this->encryptionModulus);
115 template <
typename T_CiphertextImpl>
116 template <
typename T_DataType>
118 if (!this->encryptionModulus) {
119 throw std::runtime_error(
"This operation requires the encryption modulus.");
123 throw std::runtime_error(
"The plaintext term should not be 0.");
126 T_CiphertextImpl output(this->data.GetPowModN(input, *this->encryptionModulus), this->encryptionModulus);
133 #endif//CIPHERTEXT_BASE_IMPLEMENTATION_GUARD
T_CiphertextImpl operator-() const
Homomorphic negation unary operator.
T_CiphertextImpl operator+(const T_CiphertextImpl &input) const
Homomorphic addition binary operator.
T_CiphertextImpl operator*(const T_DataType &input) const
Homomorphic multiplication binary operator.
CiphertextBase()
Default constructor.