various API uniformization

This commit is contained in:
Jean-Philippe Bossuat
2025-01-28 15:00:43 +01:00
parent 1ac719ce7e
commit 6fcd5c743d
19 changed files with 438 additions and 84 deletions

17
rlwe/src/plaintext.rs Normal file
View File

@@ -0,0 +1,17 @@
use crate::ciphertext::Ciphertext;
use crate::elem::Elem;
use crate::parameters::Parameters;
pub struct Plaintext(pub Elem);
impl Parameters {
pub fn new_plaintext(&self, log_q: usize) -> Plaintext {
Plaintext(self.new_elem(0, log_q))
}
}
impl Plaintext {
pub fn as_ciphertext(&self) -> Ciphertext {
unsafe { Ciphertext(std::ptr::read(&self.0)) }
}
}