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