# Changing ring Dimension

**URL:** <https://openfhe.discourse.group/t/changing-ring-dimension/629>\
**Category:** Library Questions\
**Created:** [June 13, 2023, 10:51am UTC](https://openfhe.discourse.group/t/changing-ring-dimension/629 "2023-06-13T10:51:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bernardo\_Ramalho](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/bernardo_ramalho/32/92_2.png) [@Bernardo\_Ramalho](https://openfhe.discourse.group/u/Bernardo_Ramalho)\
**Post date:** [June 13, 2023, 10:51am UTC](https://openfhe.discourse.group/t/changing-ring-dimension/629/1 "2023-06-13T10:51:44Z")

</div>

Hello,

So I need to change the ring dimension to test the performance I can get in my algorithms relative to the security level. But I can’t find where in the source code the decision for the ring dimension is made.

Can someone point out where the selection is made and if there are any functions I can call to change when creating the crypto context?

I have found where the standard parameter values are ([github link](https://github.com/openfheorg/openfhe-development/blob/main/src/core/lib/lattice/stdlatticeparms.cpp)) and also found the factory for the element parameters ([github link](https://github.com/openfheorg/openfhe-development/blob/main/src/core/lib/lattice/elemparamfactory.cpp)). If I can’t find any way to do it with OpenFHE functions, should I do it in one of these files?

---

<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:** [June 13, 2023, 3:19pm UTC](https://openfhe.discourse.group/t/changing-ring-dimension/629/2 "2023-06-13T15:19:20Z")

</div>

If you want to set the ring dimension for a power-of-2 value of your choice, you can do the following.

```auto
CCParams<CryptoContextXXXXXXX> parameters; // use the relevant cryptocontext parameters
parameters.SetSecurityLevel(HEStd_NotSet); // disable security
parameters.SetRingDim( yourRingDimValue ); // a power of 2 integer

```

Note that we do not recommend this hack, as sufficient security may not be achieved. Use it at your own risk.

---

<div class="post-metadata">

**Author:** ![Bernardo\_Ramalho](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/bernardo_ramalho/32/92_2.png) [@Bernardo\_Ramalho](https://openfhe.discourse.group/u/Bernardo_Ramalho)\
**Post date:** [June 13, 2023, 10:49pm UTC](https://openfhe.discourse.group/t/changing-ring-dimension/629/3 "2023-06-13T22:49:26Z")

</div>

Thank you so much, I’m using this for testing purposes in my thesis 🙂
