Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegated Private Matching for Compute (DPMC) #116

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0250a1e
Update README, add citations, fix indentation
jimouris Oct 11, 2022
a25e460
Merge branch 'facebookresearch:main' into main
jimouris Oct 14, 2022
16afaa4
Add delegated private matching for compute (DPMC)
jimouris Oct 14, 2022
a34d8ac
Merge branch 'facebookresearch:main' into dpmc
jimouris Oct 14, 2022
f65fa31
Apply NCC comments. Permute partner data and check Company PK.
jimouris Oct 24, 2022
ea50024
Merge branch 'main' into dpmc
jimouris Oct 24, 2022
49845ac
Add DPMC with secure shuffling (DSPMC)
jimouris Oct 27, 2022
0fa9583
Merge branch 'facebookresearch:main' into main
jimouris Nov 1, 2022
e10bcae
Merge branch 'main' into dpmc
jimouris Nov 1, 2022
0c34d9e
Merge branch 'dpmc' of github.com:jimouris/MR-Private-ID into dpmc
jimouris Nov 1, 2022
a687346
Merge branch 'dpmc' into dspmc
jimouris Nov 1, 2022
a9b17b3
Merge branch 'main' into dspmc
jimouris Nov 1, 2022
1b498b8
Merge branch 'facebookresearch:main' into main
jimouris Apr 11, 2023
2b5e5f7
Merge remote-tracking branch 'origin/dspmc'
jimouris Apr 11, 2023
d4f39ef
Add DPMC citation
jimouris Apr 11, 2023
81a00f6
Add feature generation in datagen script
jimouris Jul 18, 2023
0a0cbfd
Update README
jimouris Aug 13, 2023
389bea5
Merge branch 'facebookresearch:main' into main
jimouris Oct 19, 2023
2788fbc
Fix S3 build issue
jimouris Oct 19, 2023
1367738
Update README
jimouris Oct 19, 2023
762d3eb
Fix linter issues
jimouris Oct 26, 2023
a14a2d8
Update README, Dockerfile, and add docker-compose
jimouris Oct 29, 2023
c224b5b
Switch to base64 v0.13
jimouris Nov 10, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ gens
*.der
*.srl
*.seq
*.cnf

#latex artifacts
*.aux
Expand Down
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ cp bin/release/pjc-client exec && \
cp bin/release/pjc-server exec && \
cp bin/release/datagen exec && \
cp bin/release/private-id-multi-key-server exec && \
cp bin/release/private-id-multi-key-client exec

cp bin/release/private-id-multi-key-client exec && \
cp bin/release/dpmc-company-server exec && \
cp bin/release/dpmc-helper exec && \
cp bin/release/dpmc-partner-server exec && \
cp bin/release/dspmc-company-server exec && \
cp bin/release/dspmc-helper-server exec && \
cp bin/release/dspmc-partner-server exec && \
cp bin/release/dspmc-shuffler exec

# thin container with binaries
# base image is taken from here https://hub.docker.com/_/debian/
Expand Down
403 changes: 311 additions & 92 deletions README.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ path = "datagen/datagen.rs"
[dependencies]
log = "0.4"
env_logger = "0.7.1"
rayon = "1.3.0"
rayon = "1.8.0"
clap = "2.33.0"
csv = "1.1.1"
rand = { version = "0.8", features = ["small_rng"] }
Expand All @@ -23,10 +23,10 @@ hex = "0.3.0"
serde = {version = "1.0.104", features = ["derive"] }
num = "0.2.1"
wasm-timer = "0.2.5"
aws-config = "0.54.1"
aws-credential-types = "0.54.1"
aws-sdk-s3 = "0.24.0"
aws-smithy-http = "0.54.0"
aws-config = "0.56.1"
aws-credential-types = "0.56.1"
aws-sdk-s3 = "0.34.0"
aws-smithy-http = "0.56.0"
lazy_static = "1.4.0"
regex = "1.5.4"
tempfile = "3.2.0"
Expand Down
36 changes: 33 additions & 3 deletions common/datagen/datagen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub mod gen {
pub player_a: Vec<String>,
pub player_a_values: Option<Vec<u32>>,
pub player_b: Vec<String>,
pub player_b_values: Option<Vec<u32>>,
pub player_b_values: Option<Vec<String>>,
}

pub fn random_data(
Expand All @@ -40,11 +40,15 @@ pub mod gen {
player_b.extend_from_slice(&intersection);
player_b.shuffle(&mut rng);

let player_b_features = (0..(player_a_size + intersection_size))
.map(|_| random_u8().to_string())
.collect::<Vec<String>>();

Data {
player_a,
player_b,
player_a_values: None,
player_b_values: None,
player_b_values: Some(player_b_features),
}
}

Expand Down Expand Up @@ -76,6 +80,12 @@ pub mod gen {
s
}

fn random_u8() -> u8 {
let mut r = thread_rng();
let s: u8 = r.gen();
s
}

pub fn write_slice_to_file(source: &[String], cols: usize, path: &str) -> Result<(), String> {
use indicatif::ProgressBar;

Expand Down Expand Up @@ -132,6 +142,14 @@ fn main() {
.takes_value(true)
.default_value("0"),
)
.arg(
Arg::with_name("features")
.short("f")
.long("features")
.value_name("FEATURES")
.help("number of features")
.takes_value(false),
)
.get_matches();

let size = matches
Expand All @@ -145,16 +163,23 @@ fn main() {
.unwrap()
.parse::<usize>()
.expect("size param");

let gen_features = matches.is_present("features");
let dir = matches.value_of("dir").unwrap_or("./");

let fn_a = format!("{}/input_{}_size_{}_cols_{}.csv", dir, "a", size, cols);
let fn_b = format!("{}/input_{}_size_{}_cols_{}.csv", dir, "b", size, cols);
let fn_b_features = format!(
"{}/input_{}_size_{}_cols_{}_features.csv",
dir, "b", size, cols
);

info!("Generating output of size {}", size);
info!("Player a output: {}", fn_a);
info!("Player b output: {}", fn_b);
info!("Player b features: {}", fn_b_features);

let intrsct = size / 2 as usize;
let intrsct = size / 2_usize;
let size_player = size - intrsct;
let data = gen::random_data(size_player, size_player, intrsct);
info!("Data generation done, writing to files");
Expand All @@ -164,6 +189,11 @@ fn main() {
gen::write_slice_to_file(&data.player_b, cols, &fn_b).unwrap();
info!("File {} finished", fn_b);

if gen_features {
gen::write_slice_to_file(&data.player_b_values.unwrap(), 0, &fn_b_features).unwrap();
info!("File {} finished", fn_b_features);
}

info!("Bye!");
}

Expand Down
26 changes: 26 additions & 0 deletions common/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,32 @@ where
.collect::<Vec<Vec<String>>>()
}

/// Reads CSV file into vector of rows,
/// where each row is represented as a vector of u64
/// All zero length fields are removed
pub fn read_csv_as_u64<T>(filename: T) -> Vec<Vec<u64>>
where
T: AsRef<Path>,
{
let mut reader = csv::ReaderBuilder::new()
.delimiter(b',')
.flexible(false)
.has_headers(false)
.from_path(filename)
.expect("Failure reading CSV file");

let it = reader.records();
it.map(|x| {
x.unwrap()
.iter()
.map(|z| {
u64::from_str(z.trim()).unwrap_or_else(|_| panic!("Cannot format {} as u64", z))
})
.collect::<Vec<u64>>()
})
.collect::<Vec<Vec<u64>>>()
}

/// Reads CSV file into vector of rows,
/// where each row is a first as key, and then as interger-like values
pub fn read_csv_as_keyed_nums<T>(filename: T, has_headers: bool) -> Vec<KeyedNums<u64>>
Expand Down
2 changes: 1 addition & 1 deletion crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rand = "0.8"
rand_core = "0.5.1"
curve25519-dalek = "3.2"
Cupcake = { git = "https://github.com/facebookresearch/Cupcake"}
rayon = "1.3.0"
rayon = "1.8.0"
serde = {version = "1.0.104", features = ["derive"] }
bincode = "1.2.1"
num-bigint = { version = "0.4", features = ["rand"] }
Expand Down
1 change: 1 addition & 0 deletions crypto/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub use curve25519_dalek::ristretto::RistrettoPoint;
pub use curve25519_dalek::scalar;
pub use curve25519_dalek::scalar::Scalar;
pub use curve25519_dalek::traits::Identity;
pub use curve25519_dalek::traits::IsIdentity;

pub use crate::spoint::ByteBuffer;

Expand Down
Loading
Loading