Fix compressed encryptions & add GGSW compressed encryption (#67)

* Added decompress test

* updated encryption sampling & fixed bug in glwe -> lwe test

* Added GGSW compressed encryption
This commit is contained in:
Jean-Philippe Bossuat
2025-08-13 09:45:44 +02:00
committed by GitHub
parent 9aa4b1f1e2
commit 068470783e
13 changed files with 345 additions and 68 deletions

View File

@@ -192,6 +192,7 @@ impl<D: DataMut> GGLWECiphertextCompressed<D> {
let basek: usize = self.basek();
let k: usize = self.k();
let rank_in: usize = self.rank_in();
let cols: usize = self.rank_out() + 1;
let mut source_xa = Source::new(seed);
@@ -217,6 +218,7 @@ impl<D: DataMut> GGLWECiphertextCompressed<D> {
self.basek(),
self.k(),
&mut self.at_mut(row_i, col_i).data,
cols,
true,
Some((&tmp_pt, 0)),
sk,

View File

@@ -3,7 +3,7 @@ use backend::hal::{
layouts::{Backend, Data, DataMut, DataRef, MatZnx, Module, ReaderFrom, WriterTo},
};
use crate::{AutomorphismKey, GGLWECiphertext, GLWECiphertextCompressed, GLWESwitchingKey, GLWETensorKey, Infos};
use crate::{AutomorphismKey, Decompress, GGLWECiphertext, GLWECiphertextCompressed, GLWESwitchingKey, GLWETensorKey, Infos};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
#[derive(PartialEq, Eq)]
@@ -169,8 +169,8 @@ impl<D: DataRef> WriterTo for GGLWECiphertextCompressed<D> {
}
}
impl<D: DataMut> GGLWECiphertext<D> {
pub fn decompress<DataOther: DataRef, B: Backend>(&mut self, module: &Module<B>, other: &GGLWECiphertextCompressed<DataOther>)
impl<D: DataMut, B: Backend, DR: DataRef> Decompress<B, GGLWECiphertextCompressed<DR>> for GGLWECiphertext<D> {
fn decompress(&mut self, module: &Module<B>, other: &GGLWECiphertextCompressed<DR>)
where
Module<B>: VecZnxFillUniform + VecZnxCopy,
{