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/ciphertext.rs Normal file
View File

@@ -0,0 +1,17 @@
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)) }
}
}