Secure multi-party computations in Python?

Posted on Updated on

I am not into cryptography, but I recently heard through Professor Lars Kai Hansen of secure multi-party computations, where multiple persons compute on numbers they do not directly reveal to each other, – only in encrypted form.

It turns out that Aarhus has done some research in that area and even released a Python package called VIFF (Virtual Ideal Functionality Framework).

The December 14th, 2009 1.0 release can be downloaded from their homepage. They provide a standard Python setup file:

python setup.py install --home=~/python/

The installation complained as it required the gmpy package which is in standard Ubuntu:

sudo aptitude install python-gmpy

With the package is example files in the ‘apps’ directory. They require the generation of configuration files where you specify hosts and ports for the ‘persons’ that need to communicate for secure computation. To keep it simple I stayed on localhost:

./generate-config-files.py localhost:5000 localhost:5001 localhost:5002

In three different terminals you can then type (with the working directory being viff-1.0/apps):

./sum.py player-1.ini 42

./sum.py player-2.ini 3

./sum.py player-3.ini 5

This example program will sum 42, 3 and 5. Each of the running Python programs then report the result:

Sum: {50}

The three values are private to each person (here each terminal) and the result is public. If you go in the middle of the Python program and write print str(x) thinking that you can reveal one of the private values (42, 3 or 5) you only get something like:

Share at 0x9751b4c current result: {805}

Close to pure magic.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s