HElib icon indicating copy to clipboard operation
HElib copied to clipboard

How can I know the size of the ciphertext?

Open MingliWu opened this issue 5 years ago • 2 comments

I want to know how many bytes of the ciphertext I am going to send to another party. How can I do it?

MingliWu avatar Dec 07 '20 02:12 MingliWu

Hi, an estimate of the size of a serialized ciphertext object can be found here.

Consider that this estimate is absolutely experimental and subjected to change in the future.

esteffin avatar Dec 07 '20 10:12 esteffin

Thank you for your answer, @esteffin. For the BGV_packed_arithmetic example, after testing by using Ctxt.write(), I find the ctxt file size is about 3.7MB. However, using estimateCtxtSize(context, offset) and set offset=0, I only get about 2.27MB. So it seems the offset is about 3.7-2.27=1.43MB. But the question is how can I know this offset in advance? I know it is an estimated one and can be inaccurate, but why cannot we have a function Ctxt.size() just like Ctxt.write() to know the ciphertext size without writing it into a file?

MingliWu avatar Dec 08 '20 09:12 MingliWu