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/plaintext.rs
Normal file
17
rlwe/src/plaintext.rs
Normal 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)) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user