arnaucube
arnaucube/phantom-zonePublic Self-hosted repository
add fhebool example + fix BatchedFheBool's SampleExtract infinite loop
Janmajaya Mall janmajayamall@protonmail.com
Wed, 24 Jul 2024 15:46:25 -0700
commit

3587c563dc0ba2624917a82ec76aebda7d8009a0

parent

a1f966a172cc5eee0b63a9c5d2551de9b1507adf

2 files changed, 9 insertions(+), 5 deletions(-)

jump to
M src/bool/mod.rs → src/bool/mod.rs

@@ -267,17 +267,19 @@ M: SampleExtractor<M::R>,

{ fn extract_all(&self) -> Vec<FheBool<M::R>> { if self.data.len() > 0 { - let ring_size = self.data[0].dimension().0; + let ring_size = self.data[0].dimension().1; - let index = 0; + let mut index = 0; let mut out = Vec::with_capacity(self.count); while index < self.count { let row = index % ring_size; let col = index / ring_size; + out.push(FheBool { data: SampleExtractor::extract_at(&self.data[col], row), }); + index += 1; } out

@@ -288,7 +290,7 @@ }

fn extract_at(&self, index: usize) -> FheBool<M::R> { assert!(self.count > index); - let ring_size = self.data[0].dimension().0; + let ring_size = self.data[0].dimension().1; let row = index % ring_size; let col = index / ring_size;

@@ -299,9 +301,9 @@ }

fn extract_many(&self, how_many: usize) -> Vec<FheBool<M::R>> { assert!(self.count >= how_many); - let ring_size = self.data[0].dimension().0; + let ring_size = self.data[0].dimension().1; - let index = 0; + let mut index = 0; let mut out = Vec::with_capacity(self.count); while index < how_many {

@@ -310,6 +312,7 @@ let col = index / ring_size;

out.push(FheBool { data: SampleExtractor::extract_at(&self.data[col], row), }); + index += 1; } out
M src/bool/ni_mp_api.rs → src/bool/ni_mp_api.rs

@@ -36,6 +36,7 @@ OnceLock::new();

static MULTI_PARTY_CRS: OnceLock<NonInteractiveMultiPartyCrs<[u8; 32]>> = OnceLock::new(); +#[derive(Copy, Clone)] pub enum ParameterSelector { NonInteractiveLTE2Party, NonInteractiveLTE4Party,