-
Notifications
You must be signed in to change notification settings - Fork 713
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
divide_and_round_q_last_inplace math #444
Comments
|
@fionser do you mean that in order to convert from basis (a1,a2,a3) we can multiply the RNS number, coefficient-wise, by a1a2/(a1a2*a3) = 1/a3? How can this convert the basis? |
@fionser The representation of 4 in (3,5,7) is (1,4,4). When we divide and round: (1/7, 4/7, 4/7) we get (0,1,1) which is not 4 in basis (3,5) |
It's suppose to give you round(4 / 7) = 1. The algorithm is described in the comments of |
@WeiDaiWD oh right forgot and divide the left-side 4, I'm doing |
This is different from the code or what fionser described. |
|
Got it @fionser. Now we have the 3rd basis element of all coefficients Why aren't you using the BeHZ base conversion formula? Thank you! |
|
@fionser now I get it. I saw it being used in SEAL/native/src/seal/encryptor.cpp Line 138 in 88bbc51
0 , not m . So yes, it still decrypt to 0 . But why not just encrypt directly with a subset of the basis, instead of doing this modulus switching? By the way, is this the BeHZ algorithm?
I'm asking because I'm doing internal stuff on SEAL, so I did encrypt ct with a subset of size 2 from a basis of size 3, instead of doing modulus switching, then operated with conventional ciphertexts encrypted with the modulus switching technique and it worked. |
If you encrypt 0 with two primes q0 and q1 and an freshly sampled error e, now the noise size is ||e|| after decryption. If you encrypt 0 with three primes q0, q1, and q2 and an freshly sampled error e, now the noise is also ||e|| after decryption. We inserted this extra scaling of fresh encryption of zero to reduce the noise in a freshly encrypted ciphertext. This matters a lot to CKKS. |
This is not one of the algorithms in BEHZ. The BEHZ paper mainly deal with conversions between disjoint basis. In the case of |
I've been reading the pubkey encryption, which does modulus witching, which it claims it's done in
divide_and_round_q_last_inplace
. I couldn't find the math about this. Initially I though it was base conversion, because you're just switching form base Q to base Q', which has one less element. However, the BEHZ paper "Implementation and Performance Evaluation ofRNS Variants of the BFV Homomorphic Encryption
Scheme" (https://eprint.iacr.org/2018/589.pdf) does not seem to have the math implemented in this function.
Could you point me to the exact math on this?
The text was updated successfully, but these errors were encountered: