# Why do my parameters not comply with 128 bit security?

**URL:** <https://openfhe.discourse.group/t/why-do-my-parameters-not-comply-with-128-bit-security/432>\
**Category:** FHE Questions\
**Created:** [March 27, 2023, 11:16am UTC](https://openfhe.discourse.group/t/why-do-my-parameters-not-comply-with-128-bit-security/432 "2023-03-27T11:16:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LHenke](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@LHenke](https://openfhe.discourse.group/u/LHenke)\
**Post date:** [March 27, 2023, 11:16am UTC](https://openfhe.discourse.group/t/why-do-my-parameters-not-comply-with-128-bit-security/432/1 "2023-03-27T11:16:07Z")

</div>

Hello all,

I am trying to get a grasp on how model parameters play together with security levels. So I have a key generation main-file, with which I can play around. I am now curious why my parameters with

```auto
multDepth = 6
scalModsSize = 25
firstModSize = 30
ringDim = 8192

```

do not comply with 128 bit security. As it states [here](https://homomorphicencryption.org/standard/) if I want to have that security with the desired ring dimension \log (q) should be lower than 220. But for this example it is:  
\log (q) \approx 199.893  
if I get q via the method `context->GetModulus()`. I also watched this [talk](https://www.openfhe.org/portfolio-item/homomorphic-encryption-for-palisade-users/) where it says that Pallisade calculates q automatically, but how does it or rather OpenFHE now do it?  
(edit) I am using CKKS

Thanks in advance and cheers

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [March 27, 2023, 4:46pm UTC](https://openfhe.discourse.group/t/why-do-my-parameters-not-comply-with-128-bit-security/432/2 "2023-03-27T16:46:11Z")

</div>

There are other auxiliary moduli used in specific settings. For example, if you use the Hybrid Key Switching (HKS) technique (that is `parameters.SetKeySwitchTechnique(HYBRID)`), the coefficient modulus will be ~\log{}(1/dnum\*q), where dnum is a parameter of HKS - default 3. Hence, the overall modulus will be larger than the threshold you refer to above.

You can try a different key switching method (BV) that does not require additional auxiliary modules, but it will be slower.

You can also use FIXEDMANUAL/FIXEDAUTO scaling techniques (`parameters.SetScalingTechnique(FIXEDMANUAL);`) to reduce the moduli size a bit.
