Is there a way to set the RNS moduli to specific values?

Hi,

We need two CryptoContexts that share the same tower of RNS primes but have different ring dimensions. (For context, we are looking to implement the ring-switching functionality in OpenFHE: https://eprint.iacr.org/2012/240.)

Is there a way to manually set the RNS moduli to specific values within a CryptoContext? Alternatively, any other method to achieve these two contexts would be greatly appreciated.

Thanks!

I do not think there is a non-invasive way to do that. It looks to me like you would need to modify OpenFHE to achieve what you want.

Check the code in parameter generation for the scheme of interest, it should be in source file <scheme-name>rns-parametergeneration.cpp where scheme-name is either ckks, bgv, or bfv, and supply your list of prime moduli there.

1 Like