OpenFHE Parameters

I am trying to find equivalent HELib parameters in the OpenFHE library. I have a hard time finding equivalents of the following parameters:

  1. Cyclotomic polynomial - defines phi(m)

  2. Hensel lifting (default = 1)

  3. Number of bits in the modulus chain

  4. Number of columns of the Key-Switching matrix (default = 2 or 3)etc.Any explanations and pointers are highly appreciated.

Can you provide some context about what you are trying to achieve? I might be able to help you better.

Note that in OpenFHE, we ideally support power-of-2 cyclotomic rings, that is, the ring dimension N is a power of 2, hence, m = 2N. Non-power-of-2 cyclotomics are minimally supported and not advised to be used to instantiate any of the existing schemes in OpenFHE.

That being said, here are my answers to your questions:

  1. You can set the ring dimension using parameters.SetRingDim(N); // => m = 2N. We do not recommend setting this parameter manually, but if you choose to do that, you may want to set the security level to HEStd_NotSet via parameters.SetSecurityLevel(HEStd_NotSet);. Note this will disable security checks of the chosen parameters, use it at your own risk.
  2. I do not think any of the existing encoding schemes support the plaintext modulus of the form P = p^r, with p being a prime. I am afraid there is no equivalent to this. Note, that you can modify OpenFHE and add an encoding scheme that supports prime-power plaintext modulus.
  3. You can set the bit-size of certain primes in the moduli chain via parameters.SetScalingModSize(bit_size);
  4. It is better to get an estimate of the extended ciphertext modulus size from HElib and use the same or close size in OpenFHE. We advise to use parameters.SetKeySwitchTechnique(HYBRID);, and you can control the size of the expanded ciphertext modulus via parameters.SetNumLargeDigits(k); // k = 1, 2, 3, 4, 5 ... we recommend k = 3. You will need to dig deep in OpenFHE to find the total size of the coefficient modulus. I suggest printing the evaluation/public keys to get a feeling of what the prime moduli chain looks like.
1 Like

Thank you for your insightful answers. My example application using openFHE is an overly simple key-value database. The key is in plaintext, and the value is an encrypted blob. Based on your answers, I assume I can proceed with the normal OpenFHE parameters stated in the examples, as it does several things behind the scenes.