mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
gadget product working
This commit is contained in:
@@ -63,17 +63,10 @@ pub struct GadgetCiphertext {
|
||||
pub value: Vec<VmpPMat>,
|
||||
pub log_base2k: usize,
|
||||
pub log_q: usize,
|
||||
pub log_scale: usize,
|
||||
}
|
||||
|
||||
impl GadgetCiphertext {
|
||||
pub fn new(
|
||||
module: &Module,
|
||||
log_base2k: usize,
|
||||
rows: usize,
|
||||
log_q: usize,
|
||||
log_scale: usize,
|
||||
) -> Self {
|
||||
pub fn new(module: &Module, log_base2k: usize, rows: usize, log_q: usize) -> Self {
|
||||
let cols: usize = (log_q + log_base2k - 1) / log_base2k;
|
||||
let mut value: Vec<VmpPMat> = Vec::new();
|
||||
(0..rows).for_each(|_| value.push(module.new_vmp_pmat(rows, cols)));
|
||||
@@ -81,7 +74,6 @@ impl GadgetCiphertext {
|
||||
value,
|
||||
log_base2k,
|
||||
log_q,
|
||||
log_scale,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ pub struct Decryptor {
|
||||
|
||||
impl Decryptor {
|
||||
pub fn new(params: &Parameters, sk: &SecretKey) -> Self {
|
||||
let mut sk_svp_ppol: SvpPPol = params.module().svp_new_ppol();
|
||||
let mut sk_svp_ppol: SvpPPol = params.module().new_svp_ppol();
|
||||
sk.prepare(params.module(), &mut sk_svp_ppol);
|
||||
Self { sk: sk_svp_ppol }
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ pub struct EncryptorSk {
|
||||
|
||||
impl EncryptorSk {
|
||||
pub fn new(params: &Parameters, sk: Option<&SecretKey>) -> Self {
|
||||
let mut sk_svp_ppol: SvpPPol = params.module().svp_new_ppol();
|
||||
let mut sk_svp_ppol: SvpPPol = params.module().new_svp_ppol();
|
||||
let mut initialized: bool = false;
|
||||
if let Some(sk) = sk {
|
||||
sk.prepare(params.module(), &mut sk_svp_ppol);
|
||||
|
||||
@@ -61,16 +61,8 @@ impl PublicKey {
|
||||
pub struct SwitchingKey(pub GadgetCiphertext);
|
||||
|
||||
impl SwitchingKey {
|
||||
pub fn new(
|
||||
module: &Module,
|
||||
log_base2k: usize,
|
||||
rows: usize,
|
||||
log_q: usize,
|
||||
log_scale: usize,
|
||||
) -> SwitchingKey {
|
||||
SwitchingKey(GadgetCiphertext::new(
|
||||
module, log_base2k, rows, log_q, log_scale,
|
||||
))
|
||||
pub fn new(module: &Module, log_base2k: usize, rows: usize, log_q: usize) -> SwitchingKey {
|
||||
SwitchingKey(GadgetCiphertext::new(module, log_base2k, rows, log_q))
|
||||
}
|
||||
|
||||
pub fn gen_thread_safe(
|
||||
|
||||
Reference in New Issue
Block a user