Skip to content

Commit

Permalink
[oprf][shuffle] OPRF Shuffle using a 2-round 4-message shuffle protoc…
Browse files Browse the repository at this point in the history
…ol (#816)

* [oprf][shuffle] OPRF Shuffle using a 2-round 4-message shuffle protocol

Implementation of the protocol (not sharded)

---------

Co-authored-by: Artem Ignatyev <[email protected]>
Co-authored-by: Alex Koshelev <[email protected]>
  • Loading branch information
3 people authored Nov 7, 2023
1 parent fa1f394 commit 650cb4b
Show file tree
Hide file tree
Showing 16 changed files with 449 additions and 30 deletions.
27 changes: 24 additions & 3 deletions src/ff/galois_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,31 @@ macro_rules! bit_array_impl {
// = 01011001
// Since the coefficients are in GF(2), we can just XOR these bitwise representations.
// Note for x^7 + x^7 = 0 because 1 + 1 = 0 in GF(2)
impl std::ops::Add for $name {
impl <'a, 'b> std::ops::Add<&'b $name> for &'a $name {
type Output = $name;
fn add(self, rhs: &'b $name) -> Self::Output {
$name(self.0 ^ rhs.0)
}
}

impl std::ops::Add<&$name> for $name {
type Output = Self;
fn add(self, rhs: &$name) -> Self::Output {
std::ops::Add::add(&self, rhs)
}
}

impl std::ops::Add<$name> for &$name {
type Output = $name;
fn add(self, rhs: $name) -> Self::Output {
std::ops::Add::add(self, &rhs)
}
}

impl std::ops::Add<$name> for $name {
type Output = Self;
fn add(self, rhs: Self) -> Self::Output {
Self(self.0 ^ rhs.0)
fn add(self, rhs: $name) -> Self::Output {
std::ops::Add::add(&self, &rhs)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pub mod oprf_shuffle;

use std::{
fmt::{Debug, Display, Formatter},
num::NonZeroU32,
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/transport/query/oprf_shuffle.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub struct QueryConfig {}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub mod error;
pub mod ff;
pub mod helpers;
pub mod hpke;

#[cfg(feature = "web-app")]
pub mod net;
pub mod protocol;
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/protocol/basics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod apply_permutation;
pub mod check_zero;
mod if_else;
pub(crate) mod mul;
Expand Down
2 changes: 2 additions & 0 deletions src/protocol/ipa_prf/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[cfg(feature = "descriptive-gate")]
pub mod prf_eval;
pub mod prf_sharding;
#[cfg(feature = "descriptive-gate")]
pub mod shuffle;
Loading

0 comments on commit 650cb4b

Please sign in to comment.