Input size in binfhe

Hi, I have few questions regarding the size of the message space in binfhe (i.e with FHEW or TFHE).

  1. It seems, when I call GetMaxPlaintextSpace(), that the maximum message size is 3bits, is it right or am I missing something ?
  2. Why it is limited to 3 bits ?
  3. When I want to do scalar multiplication, it can only handle 2bits ( for example : [1]*4 = [0] while it should be [4])
    Can you enlighten me on that, please ?

Thank you in advance.

By default, the plaintext modulus is set to 4. This corresponds to the original FHEW/TFHE (configured for Boolean circuit evaluation) described in FHEW: Bootstrapping Homomorphic Encryption in less than a second (See Section 4).

You can increase the modulus, as illustrated in eval-sign.cpp and eval-function.cpp.

GetMaxPlaintextSpace() gives the maximum plaintext space supported for the current value of q. This is the maximum plaintext space supported using a single bootstrapping.

It is possible to work with higher plaintext moduli, as illustrated in eval-sign.cpp. In this case, multiple bootstrapping invocations are needed; the ciphertext is split in digits, and each digit is processed separately. This logic is explained in Large-Precision Homomorphic Sign Evaluation using FHEW/TFHE Bootstrapping.