arnaucube
arnaucube/poulpyPublic Self-hosted repository
Improve GGSW-based blind rotation API
Pro7ech jeanphilippe.bossuat@gmail.com
Tue, 28 Oct 2025 11:04:47 +0100
commit

787504c230eca54118e4610b92ba1e7cee33f203

parent

8ba01a64203f73630e9c80e5d7d71582676bba11

M CHANGELOG.md → CHANGELOG.md

@@ -2,13 +2,18 @@ # CHANGELOG

## [0.3.2] - 2025-10-27 +### `poulpy-schemes` + - Added `sign` argument to GGSW-based blind rotation, which enables to choose the rotation direction of the test vector. + +## [0.3.2] - 2025-10-27 + ### `poulpy-hal` - Improved convolution functionality ### `poulpy-core` - Rename `GLWEToLWESwitchingKey` to `GLWEToLWEKey`. - Rename `LWEToGLWESwitchingKey` to `LWEToGLWEKey`. - - Add `GLWESecretTensor` which stores the flattened upper triangular matrix of the pairs `sk[i] * sk[j]`. + - Add `GLWESecretTensor` which stores the flattened upper right of the tensor matrix of the pairs `sk[i] * sk[j]`. - Add `GGLWEToGGSWKey`, `GGLWEToGGSWKeyPrepared`, `GGLWEToGGSWKeyCompressed`, which encrypts the full tensor matrix of all pairs `sk[i] * sk[j]`, with one `GGLWE` per row. - Update `GGLWEToGGSW` API to take `GGLWEToGGSWKey` instead of the `GLWETensorKey` - Add `GLWETensor`, the result of tensoring two `GLWE` of identical rank.
M Cargo.lock → Cargo.lock

@@ -401,7 +401,7 @@ ]

[[package]] name = "poulpy-schemes" -version = "0.3.2" +version = "0.3.3" dependencies = [ "byteorder", "criterion",
M poulpy-schemes/Cargo.toml → poulpy-schemes/Cargo.toml

@@ -1,6 +1,6 @@

[package] name = "poulpy-schemes" -version = "0.3.2" +version = "0.3.3" edition = "2024" license = "Apache-2.0" readme = "README.md"
M poulpy-schemes/src/tfhe/bdd_arithmetic/blind_rotation.rs → poulpy-schemes/src/tfhe/bdd_arithmetic/blind_rotation.rs

@@ -36,7 +36,8 @@ &self,

res: &mut R, a: &A, k: &K, - bit_start: usize, + sign: bool, + bit_rsh: usize, bit_mask: usize, bit_lsh: usize, scratch: &mut Scratch<BE>,

@@ -58,7 +59,8 @@ self.glwe_to_glwe_blind_rotation(

&mut res.at_mut(row, col), &a.at(row, col), k, - bit_start, + sign, + bit_rsh, bit_mask, bit_lsh, scratch,

@@ -81,7 +83,8 @@ &self,

res: &mut R, test_vector: &S, k: &K, - bit_start: usize, + sign: bool, + bit_rsh: usize, bit_mask: usize, bit_lsh: usize, scratch: &mut Scratch<BE>,

@@ -115,7 +118,8 @@ self.glwe_to_glwe_blind_rotation(

&mut res.at_mut(row, col), &tmp_glwe, k, - bit_start, + sign, + bit_rsh, bit_mask, bit_lsh, scratch_1,

@@ -146,12 +150,13 @@ self.cmux_tmp_bytes(res_infos, res_infos, k_infos) + GLWE::bytes_of_from_infos(res_infos)

} #[allow(clippy::too_many_arguments)] - /// res <- a * X^{((k>>bit_rsh) % 2^bit_mask) << bit_lsh}. + /// res <- a * X^{sign * ((k>>bit_rsh) % 2^bit_mask) << bit_lsh}. fn glwe_to_glwe_blind_rotation<R, A, K>( &self, res: &mut R, a: &A, k: &K, + sign: bool, bit_rsh: usize, bit_mask: usize, bit_lsh: usize,

@@ -170,7 +175,10 @@

let (mut tmp_res, scratch_1) = scratch.take_glwe(&res); // a <- a ; b <- a * X^{-2^{i + bit_lsh}} - self.glwe_rotate(-1 << bit_lsh, &mut res, a); + match sign { + true => self.glwe_rotate(1 << bit_lsh, &mut res, a), + false => self.glwe_rotate(-1 << bit_lsh, &mut res, a), + } // b <- (b - a) * GGSW(b[i]) + a self.cmux_inplace(&mut res, a, &k.get_bit(bit_rsh), scratch_1);

@@ -187,7 +195,10 @@ (&mut tmp_res, &mut res)

}; // a <- a ; b <- a * X^{-2^{i + bit_lsh}} - self.glwe_rotate(-1 << (i + bit_lsh), b, a); + match sign { + true => self.glwe_rotate(1 << (i + bit_lsh), b, a), + false => self.glwe_rotate(-1 << (i + bit_lsh), b, a), + } // b <- (b - a) * GGSW(b[i]) + a self.cmux_inplace(b, a, &k.get_bit(i + bit_rsh), scratch_1);
M poulpy-schemes/src/tfhe/bdd_arithmetic/tests/test_suite/ggsw_blind_rotations.rs → poulpy-schemes/src/tfhe/bdd_arithmetic/tests/test_suite/ggsw_blind_rotations.rs

@@ -121,6 +121,7 @@ module.scalar_to_ggsw_blind_rotation(

&mut res, &scalar, &k_enc_prep, + false, bit_start, bit_size, bit_step,
M poulpy-schemes/src/tfhe/bdd_arithmetic/tests/test_suite/glwe_blind_rotation.rs → poulpy-schemes/src/tfhe/bdd_arithmetic/tests/test_suite/glwe_blind_rotation.rs

@@ -106,6 +106,7 @@ module.glwe_to_glwe_blind_rotation(

&mut res, &test_glwe, &k_enc_prep, + false, bit_start, bit_size, bit_step,