Hello OpenFHE Team,
Again, I apologize for posting frequently, but I’ve encountered another issue that I believe is worth reporting.
Below is a minimal snippet of the code that reproduces the issue:
#include <iostream>
#include "openfhe.h"
using namespace lbcrypto;
using namespace std;
int main(void)
{
CCParams<CryptoContextBGVRNS> parameters;
parameters.SetRingDim(32768);
parameters.SetMultiplicativeDepth(3);
parameters.SetPlaintextModulus(65537);
parameters.SetSecurityLevel(HEStd_256_classic);
parameters.SetScalingTechnique(FIXEDMANUAL); //or FIXEDAUTO, NORESCALE
CryptoContext<DCRTPoly> cc = GenCryptoContext(parameters);
cc->Enable(PKE);
cc->Enable(KEYSWITCH);
cc->Enable(LEVELEDSHE);
KeyPair<DCRTPoly> keyPair;
keyPair = cc->KeyGen();
vector<int64_t> tmp_vec_(1);
Plaintext tmp;
Ciphertext<DCRTPoly> x;
vector<int64_t> tmp_vec_1 = {1};
tmp = cc->MakePackedPlaintext(tmp_vec_1);
x = cc->Encrypt(keyPair.publicKey, tmp);
cc->Decrypt(keyPair.secretKey, x, &tmp);
tmp->SetLength(1);
tmp_vec_ = tmp->GetPackedValue();
for (auto v : tmp_vec_)
{
cout << v << " ";
}
cout << endl;
return 0;
}
When executed on OpenFHE v1.0.4, this code produces a correct result:
1
However, when I change it to the latest version (OpenFHE v1.1.4), it gives an incorrect result:
1222
I wanted to investigate why such a problem occurs, but I still don’t fully understand.
The program seems quite valid to me, but please let me know if there are misuses in parameter settings.
Thank you!