# Can different RNS techniques be used during CKKS computation?

**URL:** <https://openfhe.discourse.group/t/can-different-rns-techniques-be-used-during-ckks-computation/291>\
**Category:** FHE Questions\
**Tags:** questions\
**Created:** [December 23, 2022, 7:21am UTC](https://openfhe.discourse.group/t/can-different-rns-techniques-be-used-during-ckks-computation/291 "2022-12-23T07:21:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yhh](https://avatars.discourse-cdn.com/v4/letter/y/c57346/32.png) [@yhh](https://openfhe.discourse.group/u/yhh)\
**Post date:** [December 23, 2022, 7:21am UTC](https://openfhe.discourse.group/t/can-different-rns-techniques-be-used-during-ckks-computation/291/1 "2022-12-23T07:21:40Z")

</div>

I notice that there are two RNS techniques, denoted as [BEHZ-RNS](https://eprint.iacr.org/2016/510) and [HPS-RNS](https://eprint.iacr.org/2018/117),

It seems that in Microsoft SEAL, they only use HPS-RNS for key switching part?

I would like to know:  
How does it work in OpenFHE and why?

Great thanks for your help!

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [December 23, 2022, 6:20pm UTC](https://openfhe.discourse.group/t/can-different-rns-techniques-be-used-during-ckks-computation/291/2 "2022-12-23T18:20:47Z")

</div>

Hi @yhh

The BEHZ and HPS RNS variants are for BFV. Currently OpenFHE supports 4 different modes (the two new modes are described in [Revisiting Homomorphic Encryption Schemes for Finite Fields](https://eprint.iacr.org/2021/204)) All four modes are described at a high level in the **BFV scheme** section of the OpenFHE design paper [OpenFHE: Open-Source Fully Homomorphic Encryption Library](https://eprint.iacr.org/2022/915). I think the explanation given there should answer your question about how and why.

In hybrid key switching, we do use fast basis extension (see [Revisiting Homomorphic Encryption Schemes for Finite Fields](https://eprint.iacr.org/2021/204) for further information on it), which is a subroutine used in both BEHZ and HPS variants, but not the full set of RNS procedures used in BFV multiplication and decryption. Note that the key switching implementation in OpenFHE is shared for CKKS, BGV, and BFV.
