Encrypting Data
3. Create Tensors of Encrypted Data
// Define dimensions for the matrices
size_t n = 8, m = 8, p = 8;
size_t n = 8, m = 8, p = 8;
Tensor<CPUCryptoSystem::PlainText*> pt1(n, m, nullptr);
pt1.flatten();
for (size_t i = 0; i < n * m; i++) {
pt1.at(i) = new CPUCryptoSystem::PlainText(cs.make_plaintext(i + 1));
}
Tensor<CPUCryptoSystem::PlainText*> pt2(m, p, nullptr);
pt2.flatten();
for (size_t i = 0; i < m * p; i++) {
pt2.at(i) = new CPUCryptoSystem::PlainText(cs.make_plaintext(i + 1));
}
pt1.reshape({n, m});
pt2.reshape({m, p});
auto ct1 = cs.encrypt_tensor(client_node.network_public_key(), pt1);
auto ct2 = cs.encrypt_tensor(client_node.network_public_key(), pt2);4. Serialize Tensors
Last updated