fix bug for nparties > 2
@@ -34,7 +34,6 @@ impl Party {
let mut opprf_receivers = Vec::with_capacity(channels.len());
for (them, c) in channels.iter_mut() {
- println!("[party {}] initializing with party {}", me, them);
// the party with the lowest PID gets to initialize their OPPRF sender first
if me < *them {
opprf_senders.push(KmprtSender::init(c, rng)?);
@@ -117,7 +116,7 @@ impl Party {
let s = (0..ninputs)
.map(|i| {
let shares = secret_sharing_of_zero(nparties, rng);
- s_hat[i] = shares[0];
+ s_hat[i] = shares[self.id];
shares
})
.collect_vec();
@@ -186,8 +185,8 @@ mod tests {
fn test_protocol() {
let mut rng = AesRng::new();
// let nparties = (rng.gen::<usize>() % 16) + 2;
- let nparties = 3;
- let set_size = 1 << 4;
+ let nparties = 4;
+ let set_size = 1 << 10;
let set = (0..set_size).map(|_| rng.gen::<Block>()).collect_vec();
// create channels
@@ -213,7 +212,6 @@ mod tests {
let my_set = set.clone();
std::thread::spawn(move || {
let mut rng = AesRng::new();
- println!("[sender {}] begin init", pid);
let mut sender = Party::init(pid, &mut channels, &mut rng).unwrap();
println!("[sender {}] init finished", pid);
sender.send(&my_set, &mut channels, &mut rng).unwrap();
@@ -223,7 +221,6 @@ mod tests {
// create and run receiver
- println!("[receiver] begin init");
let mut receiver = Party::init(0, &mut receiver_channels, &mut rng).unwrap();
println!("[receiver] init finished");
let intersection = receiver.receive(&set, &mut receiver_channels, &mut rng).unwrap();
