use crate::math::Poly;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct IntermediateCiphertext {
pub a_polys: Vec<Poly>,
pub b_poly: Poly,
}
impl IntermediateCiphertext {
pub fn new(a_polys: Vec<Poly>, b_poly: Poly) -> Self {
Self { a_polys, b_poly }
}
pub fn dimension(&self) -> usize {
self.a_polys.len()
}
pub fn ring_dim(&self) -> usize {
self.b_poly.dimension()
}
pub fn modulus(&self) -> u64 {
self.b_poly.modulus()
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AggregatedCiphertext {
pub a_polys: Vec<Poly>,
pub b_poly: Poly,
}
impl AggregatedCiphertext {
pub fn new(a_polys: Vec<Poly>, b_poly: Poly) -> Self {
Self { a_polys, b_poly }
}
pub fn dimension(&self) -> usize {
self.a_polys.len()
}
pub fn ring_dim(&self) -> usize {
self.b_poly.dimension()
}
pub fn modulus(&self) -> u64 {
self.b_poly.modulus()
}
pub fn to_intermediate(&self) -> IntermediateCiphertext {
IntermediateCiphertext {
a_polys: self.a_polys.clone(),
b_poly: self.b_poly.clone(),
}
}
}