Skip to content

Commit

Permalink
Finalize docs v0.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
lschoe committed Oct 31, 2020
1 parent b073228 commit e71cd38
Show file tree
Hide file tree
Showing 21 changed files with 714 additions and 573 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
[![codecov](https://codecov.io/gh/lschoe/mpyc/branch/master/graph/badge.svg)](https://codecov.io/gh/lschoe/mpyc)
[![PyPI](https://img.shields.io/pypi/v/mpyc.svg)](https://pypi.org/project/mpyc/)

# MPyC [![MPyC logo](https://github.com/lschoe/mpyc/blob/master/images/MPyC_Logo.svg)](https://github.com/lschoe/mpyc) Secure Multiparty Computation in Python
# MPyC [![MPyC logo](https://raw.githubusercontent.com/lschoe/mpyc/master/images/MPyC_Logo.svg)](https://github.com/lschoe/mpyc) Secure Multiparty Computation in Python

MPyC supports secure *m*-party computation tolerating a dishonest minority of up to *t* passively corrupt parties,
where *m ≥ 1* and *0 ≤ t < m/2*. The underlying protocols are based on threshold secret sharing over finite
where *m ≥ 1* and *0 ≤ t < m/2*. The underlying cryptographic protocols are based on threshold secret sharing over finite
fields (using Shamir's threshold scheme as well as pseudorandom secret sharing).

The details of the secure computation protocols are mostly transparent due to the use of sophisticated operator overloading
combined with asynchronous evaluation of the associated protocols.

See the [MPyC homepage](https://www.win.tue.nl/~berry/mpyc/) for more info and background.

Click the "launch binder" badge above to view the entire repository and try out its notebooks in the `demos` directory without any install.
Click the "launch binder" badge above to view the entire repository and try out the Jupyter notebooks from the `demos` directory
in the cloud, without any install.

## Installation:

Expand All @@ -32,21 +33,22 @@ Otherwise, `pip install gmpy2` can be used on Linux (first running `apt install
but on Windows, this may fail with compiler errors.
Fortunately, ready-to-go Python wheels for `gmpy2` can be downloaded from Christoph Gohlke's excellent
[Unofficial Windows Binaries for Python Extension Packages](https://www.lfd.uci.edu/~gohlke/pythonlibs/) webpage.
Use, for example, `pip install gmpy2-2.0.8-cp36-cp36m-win_amd64.whl` to finish installation.
Use, for example, `pip install gmpy2-2.0.8-cp39-cp39-win_amd64.whl` to finish installation.

3. Use `run-all.sh` or `run-all.bat` in the `demos` directory to have a quick look at some demos.
The more advanced demos `bnnmnist.py` and `cnnmnist.py` require [Numpy](https://www.numpy.org/), the demo `kmsurvival.py` requires
3. Use `run-all.sh` or `run-all.bat` in the `demos` directory to have a quick look at all pure Python demos.
The demos `bnnmnist.py` and `cnnmnist.py` require [Numpy](https://www.numpy.org/), the demo `kmsurvival.py` requires
[pandas](https://pandas.pydata.org/), [Matplotlib](https://matplotlib.org/), and [lifelines](https://pypi.org/project/lifelines/),
and the demo `ridgeregression.py` even requires [Scikit-learn](https://scikit-learn.org/). Also note the example Windows batch
files in the `docs` and `tests` directories.
and the demo `ridgeregression.py` even requires [Scikit-learn](https://scikit-learn.org/). Also note the example Linux shell
scripts and Windows batch files in the `docs` and `tests` directories.

4. Directory `demos\.config` contains configuration info used to run MPyC with multiple parties. Also,
Windows batch file 'gen.bat' shows how to generate fresh key material for SSL. OpenSSL is required to generate
SSL key material of your own, use `pip install pyOpenSSL`.

5. To use the [Jupyter](https://jupyter.org/) notebooks `demos\*.ipynb`, you need to have Jupyter installed,
e.g., using `pip install jupyter`. The latest version of Jupyter will come with IPython 7.0+, which supports
e.g., using `pip install jupyter`. The latest version of Jupyter will come with IPython 7.x, which supports
top-level `await`. Instead of `mpc.run(mpc.start())` one can now simply write `await mpc.start()` anywhere in
a notebook cell, even outside a coroutine.
a notebook cell, even outside a coroutine. For Python 3.8+ you also get top-level `await` by running `python -m asyncio`
to launch a natively async REPL.

Copyright © 2018-2020 Berry Schoenmakers
Copyright © 2018-2020 Berry Schoenmakers
320 changes: 161 additions & 159 deletions demos/KaplanMeierSurvivalExplained.ipynb

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Use `-H`, `--HELP` option with any demo to see the MPyC help message.
```
usage: secretsanta.py [-H] [-h] [-C ini] [-P addr] [-M m] [-I i] [-T t] [-B b]
[--ssl] [-L l] [-K k] [--no-log] [--no-async]
[--no-barrier] [--output-windows] [--output-file] [-f F]
[--no-barrier] [--no-gmpy2] [--output-windows]
[--output-file] [-f F]
optional arguments:
-H, --HELP show this help message for MPyC and exit
Expand All @@ -30,6 +31,7 @@ MPyC parameters:
--no-log disable logging messages
--no-async disable asynchronous evaluation
--no-barrier disable barriers
--no-gmpy2 disable use of gmpy2 package
MPyC misc:
--output-windows screen output for parties i>0 (only on Windows)
Expand Down Expand Up @@ -114,5 +116,5 @@ optional arguments:
[KaplanMeierSurvivalExplained](KaplanMeierSurvivalExplained.ipynb) presents privacy-preserving Kaplan-Meier survival analysis, featuring aggregate Kaplan-Meier curves and secure logrank tests.

[4demos](4demos.ipynb) gives quick access to demos secretsanta.py, id3gini.py, lpsolver.py, cnnmnist.py.

[OneWayHashChainsExplained](OneWayHashChainsExplained.ipynb) shows a more advanced MPyC program.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Browse these HTML files at [MPyC docs](https://lschoe.github.io/mpyc/).

Using Python's [pydoc](https://docs.python.org/3/library/pydoc.html) module with the `-b` option you can browse the documentation on your own system.
Use Python's [pydoc](https://docs.python.org/3/library/pydoc.html) module with the `-b` option to browse the documentation on your own system.

See also [doc.bat](doc.bat) or [doc.sh](doc.sh).
27 changes: 18 additions & 9 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,32 @@
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>mpyc</strong></big></big> (version 0.6)</font></td
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>mpyc</strong></big></big> (version 0.7)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="https://github.com/lschoe/mpyc/blob/v0.6/mpyc/__init__.py">github.com/lschoe/mpyc/blob/v0.6/mpyc/__init__.py</a></font></td></tr></table>
<p><tt>MPyC&nbsp;is&nbsp;a&nbsp;Python&nbsp;package&nbsp;for&nbsp;secure&nbsp;multi-party&nbsp;computation&nbsp;(MPC).<br>
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="https://github.com/lschoe/mpyc/blob/v0.7/mpyc/__init__.py">github.com/lschoe/mpyc/blob/v0.7/mpyc/__init__.py</a></font></td></tr></table>
<p><tt>MPyC&nbsp;is&nbsp;a&nbsp;Python&nbsp;package&nbsp;for&nbsp;secure&nbsp;multiparty&nbsp;computation&nbsp;(MPC).<br>
&nbsp;<br>
MPyC&nbsp;provides&nbsp;a&nbsp;runtime&nbsp;for&nbsp;performing&nbsp;computations&nbsp;on&nbsp;secret-shared&nbsp;values,<br>
where&nbsp;parties&nbsp;interact&nbsp;by&nbsp;exchanging&nbsp;messages&nbsp;via&nbsp;peer-to-peer&nbsp;connections.<br>
The&nbsp;MPC&nbsp;protocols&nbsp;are&nbsp;based&nbsp;on&nbsp;Shamir's&nbsp;threshold&nbsp;secret&nbsp;sharing&nbsp;scheme<br>
and&nbsp;withstand&nbsp;passive&nbsp;adversaries&nbsp;controlling&nbsp;less&nbsp;than&nbsp;half&nbsp;of&nbsp;the&nbsp;parties.<br>
&nbsp;<br>
Secure&nbsp;integer&nbsp;and&nbsp;fixed-point&nbsp;arithmetic&nbsp;is&nbsp;supported&nbsp;for&nbsp;parameterized<br>
number&nbsp;ranges,&nbsp;also&nbsp;including&nbsp;support&nbsp;for&nbsp;comparison&nbsp;and&nbsp;bitwise&nbsp;operations.<br>
Secure&nbsp;finite&nbsp;field&nbsp;arithmetic&nbsp;is&nbsp;supported&nbsp;for&nbsp;fields&nbsp;of&nbsp;arbitrary&nbsp;order,&nbsp;as<br>
long&nbsp;as&nbsp;the&nbsp;order&nbsp;exceeds&nbsp;the&nbsp;number&nbsp;of&nbsp;parties.&nbsp;Secure&nbsp;integer&nbsp;and&nbsp;fixed-point<br>
arithmetic&nbsp;is&nbsp;supported&nbsp;for&nbsp;parameterized&nbsp;number&nbsp;ranges,&nbsp;also&nbsp;including&nbsp;support<br>
for&nbsp;comparison&nbsp;and&nbsp;bitwise&nbsp;operations.<br>
These&nbsp;operations&nbsp;are&nbsp;all&nbsp;available&nbsp;via&nbsp;Python's&nbsp;operator&nbsp;overloading.<br>
Some&nbsp;operations&nbsp;for&nbsp;container&nbsp;datatypes&nbsp;holding&nbsp;secret-shared&nbsp;data&nbsp;items<br>
are&nbsp;provided&nbsp;as&nbsp;well&nbsp;(e.g.,&nbsp;some&nbsp;matrix-vector&nbsp;operations).</tt></p>
long&nbsp;as&nbsp;the&nbsp;order&nbsp;exceeds&nbsp;the&nbsp;number&nbsp;of&nbsp;parties.&nbsp;These&nbsp;operations&nbsp;are&nbsp;all<br>
available&nbsp;via&nbsp;Python's&nbsp;operator&nbsp;overloading.<br>
&nbsp;<br>
Secure&nbsp;drop-in&nbsp;replacements&nbsp;for&nbsp;lots&nbsp;of&nbsp;Python&nbsp;built-in&nbsp;functions,&nbsp;such&nbsp;as<br>
all(),&nbsp;any(),&nbsp;sum(),&nbsp;min(),&nbsp;max(),&nbsp;sorted()&nbsp;are&nbsp;provided,&nbsp;mimicking&nbsp;the&nbsp;Python<br>
APIs&nbsp;as&nbsp;much&nbsp;as&nbsp;possible.&nbsp;Futher&nbsp;operations&nbsp;for&nbsp;container&nbsp;datatypes&nbsp;holding<br>
secret-shared&nbsp;data&nbsp;items&nbsp;are&nbsp;provided&nbsp;as&nbsp;well&nbsp;(e.g.,&nbsp;matrix-vector&nbsp;operations<br>
like&nbsp;secure&nbsp;dot&nbsp;products).<br>
&nbsp;<br>
And&nbsp;much&nbsp;more&nbsp;functionality&nbsp;still&nbsp;in&nbsp;a&nbsp;couple&nbsp;of&nbsp;extensions&nbsp;modules:&nbsp;seclists<br>
(secure&nbsp;lists&nbsp;with&nbsp;oblivious&nbsp;access&nbsp;and&nbsp;updates),&nbsp;mpctools&nbsp;(reduce&nbsp;and&nbsp;accumulate<br>
with&nbsp;log&nbsp;round&nbsp;complexity),&nbsp;random&nbsp;(securely&nbsp;mimicking&nbsp;Python’s&nbsp;random&nbsp;module),<br>
and&nbsp;statistics&nbsp;(securely&nbsp;mimicking&nbsp;Python’s&nbsp;statistics&nbsp;module).</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
Expand Down
Loading

0 comments on commit e71cd38

Please sign in to comment.