Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computing coefficient modulus BGV scheme. #707

Open
tarakaramg opened this issue Oct 16, 2024 · 1 comment
Open

Computing coefficient modulus BGV scheme. #707

tarakaramg opened this issue Oct 16, 2024 · 1 comment

Comments

@tarakaramg
Copy link

I am trying to compute the ciphertext coefficient modulus (q) of the BGV scheme. But, I am a bit confused about how this is represented in Seal.

This is related to coeff_modulus (parms().coeff_modulus()).
However, it is not a single integer but a list of integers. I am wondering whether

  1. Is the ciphertext coefficient modulus (q) the product of all the elements of context_data.parms().coeff_modulus()?
  2. How is this number related to total_coeff_modulus?
  3. It seems to me that total_coeff_modulus = product of elements of parms().coeff_modulus(), but when I look at the values both are different. For example in the context below total_coeff_modulus is a 20-digit integer but total_coeff_modulus_bit_count is 218 bits. Why are they different?

Scheme: BFV
|
| Encryption parameters :
| scheme: BFV
| poly_modulus_degree: 8192
| coeff_modulus size: 218 (43 + 43 + 44 + 44 + 44) bits
| plain_modulus: 1024
| total_coefficient_modulus: 10537575945477046273

Thank you.

@kimlaine
Copy link
Contributor

kimlaine commented Nov 1, 2024

  1. Yes, the ciphertext modulus is the product of all individual modulus factors in context_data.parms().coeff_modulus().
  2. They are the same thing.
  3. The bit count 218 is correct. I'm guessing you are only printing the lowest 64 bits in your example above. Note that the total_coeff_modulus() function returns a pointer to uint64_t: that's where you'll need to read the 4 64-bit words of the 218-bit integer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants