Huelse / SEAL-Python

Microsoft SEAL 4.X For Python
MIT License
310 stars 66 forks source link

serialization results space cost not acceptable #57

Closed lidh15 closed 3 years ago

lidh15 commented 3 years ago

I use BFV encryption to encrypt my numbers and I want to save them, but save function created a binary file with size 128KB for each cipher text! The raw data is simply a 4Bytes int, the size increased by 32768 times which is not acceptable in my case. I didn't use Batch Encoder because I have to do independent addition on each number, can we manipulate numbers in a cipher text by index? If not, how can I have a smaller serialization of an encrypted number? I have tried pickle, it gave me 44K bytes, smaller but not really meaningful.

Huelse commented 3 years ago

This is a Homomorphic Encryption Library, you can not operate any ciphertext by index, the size of cipher is fixed (influenced by the scheme) Try to rebuild the project with zlib or zstandard, if you want a smaller cipher file size, don't forget to write the new api (with zlib or else) in wrapper.cpp

lidh15 commented 3 years ago

ok, I tried to use zlib, but it only cut the size by about 50%, it's not enough for my application, the cipher was still about 10000 fatter than the raw number. I think I need to find another library. Thank you for your help!