How to shorten the ciphertext of BFV algorithm

The examples provided in the paper demonstrate encryption of vectors. However, when I use the BFV algorithm with PlaintextModulus set to 65537 and MultiplicativeDepth set to 0, the RingDim defaults to 4096, resulting in encryption of a 4096-dimensional vector. Consequently, the ciphertext generated for a single value occupies over 150,000 characters when stored in the database.

However, I am interested in encrypting only a single number or character. Is there any way to significantly reduce the length of the ciphertext in such cases? I would greatly appreciate your insights and suggestions on this matter.

There is a way to reduce the size of the ciphertext by half, but it is a complex process that requires a good understanding of how FHE works. If you can provide more details about your problem, we may be able to help you better.

Setting the multiplicative depth to 0 is an unusual use case. It sounds like you may not need leveled or fully homomorphic encryption. Partial homomorphic encryption that supports addition, which I assume is what you are interested in, may be sufficient for your needs. If you do not intend to do any homomorphic operations, you may not need homomorphic encryption at all.

BFV is a SIMD-like scheme. So the first consideration: can multiple values be processed/stored together? In that case, you can decrease the ciphertext expansion by storing 4096 values in one ciphertext.

My exploration is to apply homomorphic encryption to databases, with the purpose of setting the multiplication depth to 0 to minimize the length of ciphertext as much as possible (although it cannot be set to 0 in actual use), otherwise the length of ciphertext will increase exponentially. I think it mainly uses homomorphic operations on individual data, making it difficult to fill the elements in high-dimensional vectors as much as possible (to improve efficiency). Do you have any suggestions for this?

Hi @scqyz557 ,

To use the ring dimension of 2048, you can use the following parameters to generate the cryptocontext

    // Sample Program: Step 1: Set CryptoContext
    CCParams<CryptoContextBFVRNS> parameters;
    parameters.SetPlaintextModulus(65537);
    parameters.SetMultiplicativeDepth(0);
    parameters.SetFirstModSize(53);

    CryptoContext<DCRTPoly> cryptoContext = GenCryptoContext(parameters);
    // Enable features that you wish to use

The modulus size should below 54 bits as recommended in Table 1 of http://homomorphicencryption.org/wp-content/uploads/2018/11/HomomorphicEncryptionStandardv1.1.pdf (for uniform ternary secrets).

Hypothetically speaking, an even smaller modulus could be used (under 27 bits) to get the ring dimension of 1024. But this will only work for smaller plaintext moduli (not 65537), for example 100. This is only supported for CoefPacked encoding (only for addition or scalar multiplication). Also, you will need to change MIN_SIZE enum option from 30 to 20 for this to work (we will apply this fix in the next release of OpenFHE).