HElib is an open-source software library that implements homomorphic encryption. It supports the BGV scheme with bootstrapping and the Approximate Number CKKS scheme. HElib also includes optimizations for efficient homomorphic evaluation, focusing on effective use of ciphertext packing techniques and on the Gentry-Halevi-Smart optimizations.
Hi team,
I want to estimate the noise in the ciphertext and check if the next operation such as multiplication will cause the noise exceed the limit.
I noticed the function isCorrect() provided in Ctxt.cpp can help us check if the ciphertext can be decrypted correctly. But isCorrect()works after the holomorphic operation.
For example, after 2nd multiplication, we can decrypt the ciphertext correctly, but the 3rd multiplication will cause the noise to exceed the bound. How can I check this without performing the 3rd multiplication?
A simple code example:
Parameters:
unsigned long p = 127;
unsigned long m = 12800;
unsigned long r = 1;
unsigned long bits = 119;
unsigned long c = 2;
Ctxt ctxt1(public_key);
Ctxt ctxt2(public_key);
// initialize vectors
vector<long> cmsg1(ea.size());
vector<long> cmsg2(ea.size());
for (int i = 0; i < ea.size(); i++)
{
cmsg1[i] = 2;
cmsg2[i] = 2;
}
// Multiple multiplications
ea.encrypt(ctxt1, public_key, cmsg1);
ea.encrypt(ctxt2, public_key, cmsg2);
for (int i = 0; i < 4; i++) {
ctxt2.multiplyBy(ctxt1);
cout << "Noise bound after " << i << "-th mul = " << ctxt2.getNoiseBound() << endl;
cout << "isCorrect after " << i << "-th mul = " << ctxt2.isCorrect() << endl;
}
Results:
Noise bound after 0-th mul = 0.1276721535e31
isCorrect after 0-th mul = 1
Noise bound after 1-th mul = 0.6803340028e37
isCorrect after 1-th mul = 1
Noise bound after 2-th mul = 0.1309239747e29
isCorrect after 2-th mul = 1
Noise bound after 3-th mul = 0.2706827396e35
isCorrect after 3-th mul = 0
We can see that isCorrect() shows the result of 3-th mul cannot be decrypted correctly. So is there any other functions help me check this before 3-th mul so that I won't perform 3-th mul.
Hi team, I want to estimate the noise in the ciphertext and check if the next operation such as multiplication will cause the noise exceed the limit. I noticed the function
isCorrect()
provided inCtxt.cpp
can help us check if the ciphertext can be decrypted correctly. ButisCorrect()
works after the holomorphic operation. For example, after 2nd multiplication, we can decrypt the ciphertext correctly, but the 3rd multiplication will cause the noise to exceed the bound. How can I check this without performing the 3rd multiplication?A simple code example:
Results:
We can see that
isCorrect()
shows the result of 3-th mul cannot be decrypted correctly. So is there any other functions help me check this before 3-th mul so that I won't perform 3-th mul.