diff --git a/README.md b/README.md index 5a46f285..b227d4f9 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,6 @@ By running `python -m mpyc` instead you even get this REPL with the MPyC runtime - Directory `demos\.config` contains configuration info used to run MPyC with multiple parties. The file `gen.bat` shows how to generate fresh key material for SSL. To generate SSL key material of your own, first run -`pip install cryptography` (alternatively, run `pip install pyOpenSSL`). +`pip install cryptography`. Copyright © 2018-2024 Berry Schoenmakers \ No newline at end of file diff --git a/demos/aes.py b/demos/aes.py index caac0977..b54d63c1 100644 --- a/demos/aes.py +++ b/demos/aes.py @@ -1,5 +1,7 @@ """Demo Threshold AES cipher. +See np_aes.py for a reimplementation of this demo using secure arrays. + The demo performs an AES encryption followed by an AES decryption for a 128-bit AES key and a 256-bit AES key, cf. the examples in Appendices C.1 and C.3 of the Advanced Encryption Standard (FIPS 197). diff --git a/demos/bnnmnist.py b/demos/bnnmnist.py index 2faa35b8..9b6359c0 100644 --- a/demos/bnnmnist.py +++ b/demos/bnnmnist.py @@ -1,5 +1,7 @@ """Demo Binarized Neural Network (Multilayer Perceptron) MNIST classifier. +See np_bnnmnist.py for a reimplementation of this demo using secure arrays. + MPyC demo accompanying the paper 'Fast Secure Comparison for Medium-Sized Integers and Its Application in Binarized Neural Networks' by Mark Abspoel, Niek J. Bouman, Berry Schoenmakers, and Niels de Vreede, Cryptographer's diff --git a/demos/cnnmnist.py b/demos/cnnmnist.py index 1997fa37..0683bced 100644 --- a/demos/cnnmnist.py +++ b/demos/cnnmnist.py @@ -1,5 +1,7 @@ """Demo Convolutional Neural Network (CNN) MNIST classifier. +See np_cnnmnist.py for a reimplementation of this demo using secure arrays. + The MNIST dataset of handwritten digits consists of a training set of 60,000 images and a test set of 10,000 images. The training images have been used in the clear to obtain a highly reliable CNN classifier. The demo diff --git a/demos/id3gini.py b/demos/id3gini.py index 2f9cf057..ff6bfe00 100644 --- a/demos/id3gini.py +++ b/demos/id3gini.py @@ -1,5 +1,7 @@ """Demo decision tree learning using ID3. +See np_id3gini.py for a reimplementation of this demo using secure arrays. + This demo implements Protocol 4.1 from the paper 'Practical Secure Decision Tree Learning in a Teletreatment Application' by Sebastiaan de Hoogh, Berry Schoenmakers, Ping Chen, and Harm op den Akker, which appeared at the 18th diff --git a/demos/lpsolver.py b/demos/lpsolver.py index debf8844..5fbc183a 100644 --- a/demos/lpsolver.py +++ b/demos/lpsolver.py @@ -1,5 +1,7 @@ """Demo Linear Programming (LP) solver, using secure integer arithmetic. +See np_lpsolver.py for a reimplementation of this demo using secure arrays. + The LP solver returns a solution to the following problem: Given m x n matrix A, length-m vector b >= 0, and length-n vector c. diff --git a/demos/lpsolverfxp.py b/demos/lpsolverfxp.py index 01df4c99..24b834fe 100644 --- a/demos/lpsolverfxp.py +++ b/demos/lpsolverfxp.py @@ -1,5 +1,7 @@ """Demo Linear Programming (LP) solver, using secure fixed-point arithmetic. +See np_lpsolverfxp.py for a reimplementation of this demo using secure arrays. + See the demo lpsolver.py for background and explanation. Unlike the lpsolver.py demo which is based on exact (hence deterministic) secure diff --git a/demos/onewayhashchains.py b/demos/onewayhashchains.py index e000f3ee..05b656db 100644 --- a/demos/onewayhashchains.py +++ b/demos/onewayhashchains.py @@ -1,5 +1,7 @@ """Demo Threshold One-Way Hash Chains. +See np_onewayhashchains.py for a reimplementation of this demo using secure arrays. + This MPyC demo shows how to generate and reverse one-way hash chains in a multiparty setting. The seed for a hash chain, which serves as the private key, is generated jointly at random such that no party learns any information about it. Subsequently, the hash chain is built and diff --git a/mpyc/mpctools.py b/mpyc/mpctools.py index e6d07f51..870e5618 100644 --- a/mpyc/mpctools.py +++ b/mpyc/mpctools.py @@ -46,8 +46,8 @@ def accumulate(x, f=operator.add, initial=_no_value): the accumulated results over all (nonempty) prefixes of the given iterable x. The applications of f are arranged such that the maximum depth is logarithmic - in the number of elements of x, at the cost of increasing the total number of - applications of f by a logarithmic factor as well. + in the number of elements of x, potentially at the cost of increasing the total + number of applications of f by a logarithmic factor as well. In contrast, Python's itertools.accumulate() higher-order function arranges the applications of f in a linear fashion, as in general it cannot be assumed @@ -62,8 +62,8 @@ def accumulate(x, f=operator.add, initial=_no_value): x.insert(0, initial) n = len(x) if runtime.options.no_prss and n >= 32: - # Minimize f-complexity of acc(0, n). - # For n=2^k, k>=0: f-complexity=2n - 2 - log2 n calls, f-depth=max(2 log2 n - 1, 0) rounds. + # Minimize f-complexity of acc(0, n) a la Brent-Kung. + # For n=2^k, k>=0: f-complexity=2n-2-k calls, f-depth=max(2k-2, k) rounds. def acc(i, j): h = (i + j)//2 if i < h: @@ -74,8 +74,8 @@ def acc(i, j): acc(h, j) x[j-1] = f(a, x[j-1]) else: - # Minimize f-depth of acc(0, n) - # For n=2^k, k>=0: f-complexity=(n/2) log2 n calls, f-depth=log2 n rounds. + # Minimize f-depth of acc(0, n) a la Sklansky. + # For n=2^k, k>=0: f-complexity=(n/2)k calls, f-depth=k rounds. def acc(i, j): h = (i + j)//2 if i < h: