openfheorg / openfhe-development

This is the development repository for the OpenFHE library. The current (stable) version is v1.2.0 (released on June 25, 2024).
BSD 2-Clause "Simplified" License
691 stars 179 forks source link

Add BGV-like modulus switching support to BFV #715

Closed yspolyakov closed 5 months ago

yspolyakov commented 5 months ago

Currently, HPSPOVERQLEVELED automatically drops extra RNS limbs inside homomorphic multiplication and key switching, but the full ciphertext modulus is used for all operations. Also, modulus switching is supported at the very end (before decryption).

We want to add an ability to do modulus switching even when more computations need to be performed. Moreover, we want to support encoding of plaintexts at a specific level (similar to how it works in BGV).

yspolyakov commented 5 months ago

A summary of the BFV operations that have been changed:

  1. Added support for encoding at a desired level
  2. Added support for encryption from reduced plaintexts (some precomputed parameters were extended to a vector)
  3. Added support for adding/subtracting plaintexts at a given level
  4. Fixed decryption (single-key and threshold FHE) to support the scenarios with intermediate levels
  5. Fixed compression to leave more than 1 RNS limb after compression
  6. Fixed EvalMult
  7. Fixed EvalSquare
  8. Fixed EvalFastRotation
  9. Disabled BFV modulus switching for BEHZ and HPS multiplication modes and EXTENDED encryption mode
  10. Added unit tests