void ChooserEncoder::encode(BigUInt value, ChooserPoly &destination)
 {
     BigPoly value_poly = encoder_.encode(value);
     destination.reset();
     destination.max_coeff_count() = value_poly.significant_coeff_count();
     destination.max_abs_value() = poly_infty_norm_coeffmod(value_poly, encoder_.plain_modulus());
 }
Ejemplo n.º 2
0
 void ChooserEncoder::encode(BigUInt value, ChooserPoly &destination)
 {
     Plaintext value_poly;
     encoder_.encode(value, value_poly);
     destination.reset();
     destination.max_coeff_count() = value_poly.significant_coeff_count();
     destination.max_abs_value() = poly_infty_norm_coeffmod(
         value_poly.data(), value_poly.coeff_count(), encoder_.plain_modulus());
 }
 void ChooserEncryptor::decrypt(const ChooserPoly &encrypted, ChooserPoly &destination) const
 {
     if (encrypted.comp_ == nullptr)
     {
         throw invalid_argument("encrypted has null operation history");
     }
     destination.reset();
     destination.max_abs_value() = encrypted.max_abs_value();
     destination.max_coeff_count() = encrypted.max_coeff_count();
 }
 void ChooserEncryptor::encrypt(const ChooserPoly &plain, ChooserPoly &destination) const
 {
     if (plain.comp_ != nullptr)
     {
         throw invalid_argument("plain has non-null operation history");
     }
     destination = plain;
     destination.set_fresh();
 }