Use Ctxt::isCorrect() to check Ctxt valid in using HElib

During using HElib, if the calculation made Ctxt‘s noise too big, it will cause Ctxt can’t be decrypted successfully, and the decrypted result is messy like this:

333317397173303 1016371194582039 217550837977960
737191953777559 1103851234911944 454685807668230
625213263895453 743713807221034 1036409711005678
447878070619549 603715795412661 948856958008786
......

You can leverage Ctxt::isCorrect() method to check whether Ctxt is still valid or not:

std::cout << "Ctxt is valid: " << c.isCorrect() << '\n';

Reference:
Maybe the bug in EncryptedArray’s shift function.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.