MCPcopy Create free account
hub / github.com/OpenMined/TenSEAL / decrypt

Method decrypt

tenseal/cpp/tensors/bfvvector.cpp:88–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88BFVVector::plain_t BFVVector::decrypt(const shared_ptr<SecretKey>& sk) const {
89 vector<int64_t> result;
90 result.reserve(this->size());
91
92 for (size_t idx = 0; idx < this->_ciphertexts.size(); ++idx) {
93 vector<int64_t> partial_result;
94
95 Plaintext plaintext;
96 this->tenseal_context()->decrypt(*sk, this->_ciphertexts[idx],
97 plaintext);
98 this->tenseal_context()->decode<BatchEncoder>(plaintext,
99 partial_result);
100
101 // result contains all slots of ciphertext (poly_modulus_degree)
102 // we use the real vector size to delimit the resulting plaintext vector
103 auto partial_decr =
104 vector<int64_t>(partial_result.cbegin(),
105 partial_result.cbegin() + this->_sizes[idx]);
106 result.insert(result.end(), partial_decr.begin(), partial_decr.end());
107 }
108
109 return result;
110}
111
112shared_ptr<BFVVector> BFVVector::power_inplace(unsigned int power) {
113 // if the power is zero, return a new encrypted vector of ones

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.95
tenseal_contextMethod · 0.80
sizeMethod · 0.45
cbeginMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected