poulpy/rlwe/src/ciphertext.rs
rlwe/src/ciphertext.rsRaw
1use crate::elem::Elem;
2use crate::parameters::Parameters;
3use crate::plaintext::Plaintext;
4
5pub struct Ciphertext(pub Elem);
6
7impl Parameters {
8 pub fn new_ciphertext(&self, degree: usize, log_q: usize) -> Ciphertext {
9 Ciphertext(self.new_elem(degree, log_q))
10 }
11}
12
13impl Ciphertext {
14 pub fn as_plaintext(&self) -> Plaintext {
15 unsafe { Plaintext(std::ptr::read(&self.0)) }
16 }
17}