def __init__(self, param, prev_context_id=None, next_context_id=None): """A class used to hold parameters and perform parameters validation. 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. Attributes: prev_context_id: Id of the previous ContextData object in context chain. next_context_id: Id of the next ContextData object in context chain. coeff_div_plain_modulus: A list of float values equal to (q[i]/t), In research papers denoted by delta. rns_tool: A RNSTool class instance. """ self.validate(param) self.param = param self.prev_context_id = prev_context_id self.next_context_id = next_context_id # A list containing values of coeff_mod[i] / plain_mod for one time computation # and useful in encryption process. self.coeff_div_plain_modulus = [x / param.plain_modulus for x in param.coeff_modulus] self.rns_tool = RNSTool(param)
def __init__(self, params): # Validation of params provided for the encryption scheme. self.validate(params) self.param = params self.rns_tool = RNSTool(params)
def __init__(self, encryption_param): self.param = encryption_param self.coeff_div_plain_modulus = [ x / encryption_param.plain_modulus for x in encryption_param.coeff_modulus ] self.rns_tool = RNSTool(encryption_param)
def __init__(self, encryption_param): self.param = encryption_param # A list containing values of coeff_mod[i] / plain_mod for one time computation # and useful in encryption process. self.coeff_div_plain_modulus = [ x / encryption_param.plain_modulus for x in encryption_param.coeff_modulus ] self.rns_tool = RNSTool(encryption_param)
def test_rns_tool_fastbconv_sk(poly_len, coeff_mod, plain_mod, input, output): enc_param = EncryptionParams(poly_len, coeff_mod, plain_mod) rns_tool = RNSTool(enc_param) result = rns_tool.fastbconv_sk(input) assert result == output