-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Update FV scheme to use context chain instead of single context object #3962
Conversation
Args: | ||
param: An EncryptionParams object with polynomial modulus, coefficient modulus and | ||
plain modulus set. | ||
prev_context_id: Id of the previous ContextData object in context chain. | ||
next_context_id: Id of the next ContextData object in context chain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the Args be in the init method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will put the whole doc component inside init
|
||
else: | ||
raise ValueError("key for encryption is not valid") | ||
|
||
def _encrypt(self, message, is_asymmetric): | ||
def _encrypt(self, message, param_id, is_asymmetric): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can update the doc here
if not is_initialized: | ||
self._secret_key = SecretKey(sample_poly_ternary(param)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no more init checking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_initialized
is no more needed because if the context is not set up it will throw the error while validation in context class. So the secret key can be created using context(anytime with validated context object). And for other keys, I will check for the None value of secret key.
@@ -109,7 +109,7 @@ def sample_poly_uniform(param): | |||
return result | |||
|
|||
|
|||
def encrypt_asymmetric(context, public_key): | |||
def encrypt_asymmetric(context, param_id, public_key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can update the doc here
|
||
|
||
def encrypt_symmetric(context, secret_key): | ||
def encrypt_symmetric(context, param_id, secret_key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Codecov Report
@@ Coverage Diff @@
## master #3962 +/- ##
==========================================
+ Coverage 94.85% 94.88% +0.03%
==========================================
Files 202 202
Lines 20735 20879 +144
==========================================
+ Hits 19669 19812 +143
- Misses 1066 1067 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
For Relinearization operation, we need to perform modulus switching which requires the context chain to have context object with different coefficient modulus value.
Affected Dependencies
None
How has this been tested?
All tests for components passing
Checklist