homenc / HElib

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.
https://homenc.github.io/HElib
Other
3.11k stars 759 forks source link

Thin Slots to Coeff does not work for p=257? #506

Open AYANG005 opened 3 months ago

AYANG005 commented 3 months ago

Hi everyone,

Does anyone have experience with using the "thin" slots to coefficients transformation in HElib for the p=257 case? It doesn't seem to output the sparsely packed slot elements as the coefficients of the plaintext polynomial for some reason. When I run it with p=127 however, it works. Would anyone know why this might be the case, and perhaps know anyway around it?

Here's what I am running for that portion, with the sparse entires of encoded_ptxt not corresponding to my previous slots: //Slots to Coeff map NTL::Vec mvec; mvec.append(65536); ThinEvalMap tested = ThinEvalMap(ea, false, mvec, false, false); tested.apply(ctxt); ZZX encoded_ptxt; ZZX unmoded_ptxt; secret_key.Decrypt(encoded_ptxt, ctxt, unmoded_ptxt); cout << "Second encoded ptxt: " << encoded_ptxt << endl; cout << ctxt.isCorrect() << endl;