Files
poulpy/rlwe/src/ciphertext.rs
Jean-Philippe Bossuat 6fcd5c743d various API uniformization
2025-01-28 15:00:43 +01:00

18 lines
406 B
Rust

use crate::elem::Elem;
use crate::parameters::Parameters;
use crate::plaintext::Plaintext;
pub struct Ciphertext(pub Elem);
impl Parameters {
pub fn new_ciphertext(&self, degree: usize, log_q: usize) -> Ciphertext {
Ciphertext(self.new_elem(degree, log_q))
}
}
impl Ciphertext {
pub fn as_plaintext(&self) -> Plaintext {
unsafe { Plaintext(std::ptr::read(&self.0)) }
}
}