mirror of
https://github.com/encryptogroup/PSI.git
synced 2024-03-22 13:30:44 +08:00
Edited Readme
This commit is contained in:
parent
b4a015b012
commit
d07f0fc7fa
79
README.md
79
README.md
|
@ -1,4 +1,79 @@
|
||||||
# PSI
|
# Private Set Intersection (PSI)
|
||||||
Implementation of the OT Extension-based Private Set Intersection (PSI) protocol from [1]. The code has gone through refactoring and is not usable at the moment.
|
|
||||||
|
### Faster Private Set Intersection Based on OT Extension
|
||||||
|
|
||||||
|
By *Benny Pinkas, Thomas Schneider and Michael Zohner* in USENIX Security Symposium 2014 [1]. Please note that the code is currently being restructured and not all routines might work correctly.
|
||||||
|
|
||||||
|
### Features
|
||||||
|
---
|
||||||
|
|
||||||
|
* An implementation of different PSI protocols:
|
||||||
|
* the naive hashing solutions where elements are hashed and compared
|
||||||
|
* the server-aided protocol of [2]
|
||||||
|
* the Diffie-Hellman-based PSI protocol of [3]
|
||||||
|
* the OT-based PSI protocol of [1]
|
||||||
|
|
||||||
|
This code is provided as a experimental implementation for testing purposes and should not be used in a productive environment. We cannot guarantee security and correctness.
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
---
|
||||||
|
|
||||||
|
* A **Linux distribution** of your choice (the code was developed and tested with recent versions of [Ubuntu](http://www.ubuntu.com/)).
|
||||||
|
* **Required packages:**
|
||||||
|
* [`g++`](https://packages.debian.org/testing/g++)
|
||||||
|
* [`make`](https://packages.debian.org/testing/make)
|
||||||
|
* [`libgmp-dev`](https://packages.debian.org/testing/libgmp-dev)
|
||||||
|
* [`libglib2.0-dev`](https://packages.debian.org/testing/libglib2.0-dev)
|
||||||
|
* [`libssl-dev`](https://packages.debian.org/testing/libssl-dev)
|
||||||
|
|
||||||
|
Install these packages with your favorite package manager, e.g, `sudo apt-get install <package-name>`.
|
||||||
|
|
||||||
|
|
||||||
|
### Building the Project
|
||||||
|
|
||||||
|
1. Clone a copy of the main git repository and its submodules by running:
|
||||||
|
```
|
||||||
|
git clone --recursive git://github.com/encryptogroup/PSI
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Enter the Framework directory: `cd PSI/`
|
||||||
|
|
||||||
|
3. Call `make` in the root directory to compile all dependencies, tests, and examples and create the executables: **bench.exe** and **demo.exe**.
|
||||||
|
|
||||||
|
### Executing the Code
|
||||||
|
|
||||||
|
An example demo is included and can be run by opening two terminals in the root directory. Execute in the first terminal:
|
||||||
|
|
||||||
|
./demo.exe -r 0 -p 0 -f sample_sets/emails_alice.txt
|
||||||
|
|
||||||
|
and in the second terminal:
|
||||||
|
|
||||||
|
./demo.exe -r 1 -p 0 -f sample_sets/emails_bob.txt
|
||||||
|
|
||||||
|
|
||||||
|
This should print the following output in the second terminal:
|
||||||
|
|
||||||
|
Computation finished. Found 3 intersecting elements:
|
||||||
|
Michael.Zohner@ec-spride.de
|
||||||
|
Evelyne.Wagener@tvcablenet.be
|
||||||
|
Ivonne.Pfisterer@mail.ru
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
These commands will run the naive hashing protocol and compute the intersection on the randomly generated emails in sample_sets/emails_alice.txt and sample_sets/emails_bob.txt (where 3 intersecting elements were altered). To use a different protocol, the ['-p'] option can be varied as follows:
|
||||||
|
* `-p 0`: the naive hashing protocol
|
||||||
|
* `-p 1`: the server-aided protocol of [2] (CURRENTLY NOT WORKING)
|
||||||
|
* `-p 2`: the Diffie-Hellman-based PSI protocol of [3]
|
||||||
|
* `-p 3`: the OT-based PSI protocol of [1]
|
||||||
|
|
||||||
|
For further information about the program options, run ```./demo.exe -h```.
|
||||||
|
|
||||||
|
### References
|
||||||
|
|
||||||
[1] B. Pinkas, T. Schneider, M. Zohner. Faster Private Set Intersection Based on OT Extension. USENIX Security 2014: 797-812. Full version available at http://eprint.iacr.org/2014/447.
|
[1] B. Pinkas, T. Schneider, M. Zohner. Faster Private Set Intersection Based on OT Extension. USENIX Security 2014: 797-812. Full version available at http://eprint.iacr.org/2014/447.
|
||||||
|
|
||||||
|
[2] S. Kamara, P. Mohassel, M. Raykova, and S. Sadeghian. Scaling private set intersection to billion-element sets. In
|
||||||
|
Financial Cryptography and Data Security (FC’14) , LNCS. Springer, 2014.
|
||||||
|
|
||||||
|
[3] C. Meadows. A more efficient cryptographic matchmaking protocol for use in the absence of a continuously available third party. In IEEE S&P’86, pages 134–137. IEEE, 1986.
|
||||||
|
|
||||||
|
|
107
sample_sets/emailgenerator/Email-Providers.txt
Normal file
107
sample_sets/emailgenerator/Email-Providers.txt
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
aol.com
|
||||||
|
att.net
|
||||||
|
comcast.net
|
||||||
|
facebook.com
|
||||||
|
gmail.com
|
||||||
|
gmx.com
|
||||||
|
googlemail.com
|
||||||
|
google.com
|
||||||
|
hotmail.com
|
||||||
|
hotmail.co.uk
|
||||||
|
mac.com
|
||||||
|
me.com
|
||||||
|
mail.com
|
||||||
|
msn.com
|
||||||
|
live.com
|
||||||
|
sbcglobal.net
|
||||||
|
verizon.net
|
||||||
|
yahoo.com
|
||||||
|
yahoo.co.uk
|
||||||
|
email.com
|
||||||
|
games.com
|
||||||
|
gmx.net
|
||||||
|
hush.com
|
||||||
|
hushmail.com
|
||||||
|
inbox.com
|
||||||
|
lavabit.com
|
||||||
|
love.com
|
||||||
|
pobox.com
|
||||||
|
rocketmail.com
|
||||||
|
safe-mail.net
|
||||||
|
wow.com
|
||||||
|
ygm.com
|
||||||
|
ymail.com
|
||||||
|
zoho.com
|
||||||
|
fastmail.fm
|
||||||
|
bellsouth.net
|
||||||
|
charter.net
|
||||||
|
cox.net
|
||||||
|
earthlink.net
|
||||||
|
juno.com
|
||||||
|
btinternet.com
|
||||||
|
virginmedia.com
|
||||||
|
blueyonder.co.uk
|
||||||
|
freeserve.co.uk
|
||||||
|
live.co.uk
|
||||||
|
ntlworld.com
|
||||||
|
o2.co.uk
|
||||||
|
orange.net
|
||||||
|
sky.com
|
||||||
|
talktalk.co.uk
|
||||||
|
tiscali.co.uk
|
||||||
|
virgin.net
|
||||||
|
wanadoo.co.uk
|
||||||
|
bt.com
|
||||||
|
sina.com
|
||||||
|
qq.com
|
||||||
|
naver.com
|
||||||
|
hanmail.net
|
||||||
|
daum.net
|
||||||
|
nate.com
|
||||||
|
yahoo.co.jp
|
||||||
|
yahoo.co.kr
|
||||||
|
yahoo.co.id
|
||||||
|
yahoo.co.in
|
||||||
|
yahoo.com.sg
|
||||||
|
yahoo.com.ph
|
||||||
|
hotmail.fr
|
||||||
|
live.fr
|
||||||
|
laposte.net
|
||||||
|
yahoo.fr
|
||||||
|
wanadoo.fr
|
||||||
|
orange.fr
|
||||||
|
gmx.fr
|
||||||
|
sfr.fr
|
||||||
|
neuf.fr
|
||||||
|
free.fr
|
||||||
|
gmx.de
|
||||||
|
hotmail.de
|
||||||
|
live.de
|
||||||
|
online.de
|
||||||
|
t-online.de
|
||||||
|
web.de
|
||||||
|
yahoo.de
|
||||||
|
mail.ru
|
||||||
|
rambler.ru
|
||||||
|
yandex.ru
|
||||||
|
hotmail.be
|
||||||
|
live.be
|
||||||
|
skynet.be
|
||||||
|
voo.be
|
||||||
|
tvcablenet.be
|
||||||
|
hotmail.com.ar
|
||||||
|
live.com.ar
|
||||||
|
yahoo.com.ar
|
||||||
|
fibertel.com.ar
|
||||||
|
speedy.com.ar
|
||||||
|
arnet.com.ar
|
||||||
|
hotmail.com
|
||||||
|
gmail.com
|
||||||
|
yahoo.com.mx
|
||||||
|
live.com.mx
|
||||||
|
yahoo.com
|
||||||
|
hotmail.es
|
||||||
|
live.com
|
||||||
|
hotmail.com.mx
|
||||||
|
prodigy.net.mx
|
||||||
|
msn.com
|
3422
sample_sets/emailgenerator/Family-Names.txt
Normal file
3422
sample_sets/emailgenerator/Family-Names.txt
Normal file
File diff suppressed because it is too large
Load Diff
2004
sample_sets/emailgenerator/Given-Names.txt
Normal file
2004
sample_sets/emailgenerator/Given-Names.txt
Normal file
File diff suppressed because it is too large
Load Diff
42
sample_sets/emailgenerator/emailgen.py
Executable file
42
sample_sets/emailgenerator/emailgen.py
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
import random
|
||||||
|
import sys
|
||||||
|
from sets import Set
|
||||||
|
|
||||||
|
gnames_file = "Given-Names.txt"
|
||||||
|
fnames_file = "Family-Names.txt"
|
||||||
|
eprovs_file = "Email-Providers.txt"
|
||||||
|
|
||||||
|
STOP_AFTER_FAILURES = 20 # stop after this number of failures
|
||||||
|
|
||||||
|
if len(sys.argv)!=2:
|
||||||
|
print "Syntax: "+sys.argv[0]+" N"
|
||||||
|
print "Generates a sorted list of N unique email adresses"
|
||||||
|
exit()
|
||||||
|
N = int(sys.argv[1])
|
||||||
|
|
||||||
|
gnames = [line.strip() for line in open(gnames_file)]
|
||||||
|
fnames = [line.strip() for line in open(fnames_file)]
|
||||||
|
eprovs = [line.strip() for line in open(eprovs_file)]
|
||||||
|
|
||||||
|
# generate list of emails with N *unique* entries
|
||||||
|
emails = Set()
|
||||||
|
failures=0
|
||||||
|
while len(emails) < N:
|
||||||
|
gname = random.choice(gnames)
|
||||||
|
fname = random.choice(fnames)
|
||||||
|
eprov = random.choice(eprovs)
|
||||||
|
email=gname+'.'+fname+'@'+eprov
|
||||||
|
if (email in emails):
|
||||||
|
failures+=1
|
||||||
|
if failures == STOP_AFTER_FAILURES:
|
||||||
|
exit("Failure: Unable to generate new unique email.")
|
||||||
|
else:
|
||||||
|
failures = 0
|
||||||
|
emails.add(email)
|
||||||
|
|
||||||
|
# sort list of emails
|
||||||
|
emails_list = list(emails)
|
||||||
|
# emails_list.sort()
|
||||||
|
for e in emails_list:
|
||||||
|
print e
|
1024
sample_sets/emails_alice.txt
Normal file
1024
sample_sets/emails_alice.txt
Normal file
File diff suppressed because it is too large
Load Diff
1024
sample_sets/emails_bob.txt
Normal file
1024
sample_sets/emails_bob.txt
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -162,7 +162,6 @@ int32_t read_psi_demo_options(int32_t* argcp, char*** argvp, role_type* role, ps
|
||||||
|
|
||||||
if(!parse_options(argcp, argvp, options, sizeof(options)/sizeof(parsing_ctx))) {
|
if(!parse_options(argcp, argvp, options, sizeof(options)/sizeof(parsing_ctx))) {
|
||||||
print_usage(argvp[0][0], options, sizeof(options)/sizeof(parsing_ctx));
|
print_usage(argvp[0][0], options, sizeof(options)/sizeof(parsing_ctx));
|
||||||
cout << "Exiting" << endl;
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,23 @@
|
||||||
|
|
||||||
#include "parse_options.h"
|
#include "parse_options.h"
|
||||||
|
|
||||||
|
|
||||||
|
void print_usage(std::string progname, parsing_ctx* options, uint32_t nops) {
|
||||||
|
uint32_t i;
|
||||||
|
std::cout << "Usage: " << progname << std::endl;
|
||||||
|
for (i = 0; i < nops; i++) {
|
||||||
|
std::cout << " -" << options[i].opt_name << " [" << options[i].help_str << (options[i].required ? ", required" : ", optional") << "]" << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << std::endl << "Program exiting" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t parse_options(int32_t* argcp, char*** argvp, parsing_ctx* options, uint32_t nops) {
|
int32_t parse_options(int32_t* argcp, char*** argvp, parsing_ctx* options, uint32_t nops) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
bool skip;
|
bool skip;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
char* argvzero = argvp[0][0];
|
||||||
|
|
||||||
if(*argcp < 2)
|
if(*argcp < 2)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -16,6 +29,10 @@ int32_t parse_options(int32_t* argcp, char*** argvp, parsing_ctx* options, uint3
|
||||||
if ((*argvp)[1][0] != '-' || (*argvp)[1][1] == '\0' || (*argvp)[1][2] != '\0')
|
if ((*argvp)[1][0] != '-' || (*argvp)[1][1] == '\0' || (*argvp)[1][2] != '\0')
|
||||||
return result;
|
return result;
|
||||||
for (i = 0, skip = false; i < nops && !skip; i++) {
|
for (i = 0, skip = false; i < nops && !skip; i++) {
|
||||||
|
if (((*argvp)[1][1]) == 'h') {
|
||||||
|
print_usage(argvzero, options, nops);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
if (((*argvp)[1][1]) == options[i].opt_name) {
|
if (((*argvp)[1][1]) == options[i].opt_name) {
|
||||||
|
|
||||||
switch (options[i].type) {
|
switch (options[i].type) {
|
||||||
|
@ -56,12 +73,3 @@ int32_t parse_options(int32_t* argcp, char*** argvp, parsing_ctx* options, uint3
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_usage(std::string progname, parsing_ctx* options, uint32_t nops) {
|
|
||||||
uint32_t i;
|
|
||||||
std::cout << "Usage: " << progname << std::endl;
|
|
||||||
for (i = 0; i < nops; i++) {
|
|
||||||
std::cout << " -" << options[i].opt_name << " [" << options[i].help_str << (options[i].required ? ", required" : ", optional") << "]" << std::endl;
|
|
||||||
}
|
|
||||||
std::cout << std::endl << "Program exiting" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user