Hello,
I want to create a custom ciphertext cipher = Ciphertext from a ct = Lweciphertext<Vec>. I created ct using
allocate_and_encrypt_new_lwe_ciphertext(
lwe_secret_key,
plaintext,
lwe_noise_distribution,
ciphertext_modulus,
encryption_generator,
)
and I would like to create cipher using
Ciphertext::new(
ct: LweCiphertextOwned<u64>,
degree: Degree,
noise_level: NoiseLevel,
message_modulus: MessageModulus,
carry_modulus: CarryModulus,
pbs_order: PBSOrder,
I guess I should put 0 for Degree, 1 for NoiseLevel, message_modulus and carry_modulus are actually the parameters that I want to customise, but what should I put for pbs_order ?
Hello @Norrin_Radix
The degree is the maximum value the ciphertext can have at a given point.
For example for a MessageModulus of 4 (2 bits) when you encrypt a plaintext you can at most have 3 as a value, and so the Degree will be 3.
For the PBSOrder it’s because shortint does the computations in the following way:
compute linear operations which make the noise grow up to the MaxNoiseLevel of the parameter set. Then you can either refresh the noise and/or apply a non linear function, the way this is done is by computing a Keyswitch (KS) and then a Programmable Bootstrapping (PBS), or a PBS then a KS.
Parameter optimization show KS then PBS is better, however given you seem to be doing something custom then I don’t know what to recommend you as your parameters may neither be secure nor yield correct computations (up to a small probability of failure).
Ok thanks, I achieved what I wanted just using a short int Ciphertext, PARAM_MESSAGE_1_CARRY_0_KS_PBS and unchecked_add, I might use a PBS addition once in a while to refresh the noise. I did not see those parameters available at first, I only found messages with carries. Sorry for the disturbance. It’s all good now.