mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
various API uniformization
This commit is contained in:
17
rlwe/src/ciphertext.rs
Normal file
17
rlwe/src/ciphertext.rs
Normal 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)) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user