Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions research/InsPIRe/src/bin/inspire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,10 @@ pub fn run_simple_ypir_rgsw_on_params(
target_row,
);

assert_eq!(query_row.len(), (params.poly_len + 1) * db_rows);
let query_row_last_row: &[u64] = &query_row[params.poly_len * db_rows..];
// assert_eq!(query_row.len(), (params.poly_len + 1) * db_rows);
// let query_row_last_row: &[u64] = &query_row[params.poly_len * db_rows..];
assert_eq!(query_row.len(), db_rows);
let query_row_last_row = &query_row;

assert_eq!(query_row_last_row.len(), db_rows);
let packed_query_row = pack_query(&params, query_row_last_row);
Expand Down
14 changes: 9 additions & 5 deletions research/InsPIRe/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::time;
use std::cmp::min;

use log::debug;
Expand All @@ -15,11 +16,13 @@ use super::convolution::negacyclic_matrix_u32;
use super::{lwe::*, noise_analysis::measure_noise_width_squared, scheme::*, util::*};

pub fn rlwe_to_lwe<'a>(params: &'a Params, ct: &PolyMatrixRaw<'a>, how_many: usize) -> Vec<u64> {
let a = ct.get_poly(0, 0);
let mut negacylic_a = negacyclic_matrix(&a, params.modulus, how_many);
negacylic_a.extend(&ct.get_poly(1, 0)[0..how_many]);
// let a: &[u64] = ct.get_poly(0, 0);
// let mut negacylic_a = negacyclic_matrix(&a, params.modulus, how_many);
// negacylic_a.extend(&ct.get_poly(1, 0)[0..how_many]);
// negacylic_a

negacylic_a
// We only need the 'b' part of the LWE ciphertext
ct.get_poly(1, 0).to_vec() // TODO: check if we need how_many
}

pub fn pack_query(params: &Params, query: &[u64]) -> AlignedMemory64 {
Expand Down Expand Up @@ -217,7 +220,8 @@ impl<'a> YClient<'a> {
.iter()
.map(|ct| rlwe_to_lwe(self.params, ct, how_many))
.collect::<Vec<_>>();
concat_horizontal(&v, self.params.poly_len + 1, how_many) //self.params.poly_len)
// concat_horizontal(&v, self.params.poly_len + 1, how_many) //self.params.poly_len)
concat_horizontal(&v, 1, self.params.poly_len)
}

pub fn generate_query_impl(
Expand Down