This project is a secure multi-party computation library that designs and implements privacy-preserving computation protocols based on arithmetic secret sharing and function secret sharing. It also utilizes these protocols to implement the application of privacy-preserving machine learning, specifically privacy-preserving neural network inference.
This project requires PyTorch>=1.8.0, and it is recommended to use PyTorch==2.3.0. You can install this project by executing the following command:
pip install -e .If the external dependency csprng cannot be compiled and installed, it may be due to a lack of a c++ compiler or cuda toolkit.
For instructions on how to use the library for a privacy application, please refer to the tutorials in the pack
tutorials, which are presented as a Jupyter notebook, so please install the following in your conda environment:
conda install ipython jupyterTutorial_0_Before_Starting.ipynb- Before starting the tutorial, this notebook provides an introduction to the configuration information and auxiliary parameters required for computations in the library.Tutorial_1_Ring_Tensor.ipynb- This tutorial introduces the basic data typeRingTensorin the library. It demonstrates how to perform basic operations using RingTensor.Tutorial_2_Arithmetic_Secret_Sharing.ipynb- This tutorial explains the basic data type,ArithmeticSharedRingTensor, used for secure multi-party computation in the library. It shows how to perform basic operations using ArithmeticSharedRingTensor through arithmetic secret sharing techniques that distribute data into two shares for two participating parties.Tutorial_3_Replicated_Secret_sharing.ipynb- This tutorial introduces the basic data type,ReplicatedSecretSharing, used for secure 3-party computation in the library. It distributes data into multiple shares for multiple participating parties using replicated secret sharing techniques. The basic operations ofReplicatedSecretSharingare similar to those ofArithmeticSecretSharing, and tutorials on related basic operations are coming soon.Tutorial_4_Generate_Beaver_Triples_by_HE.ipynb- This tutorial explains how to generate Beaver triples using homomorphic encryption.Tutorial_5_Parameter.ipynb- This tutorial explains how to design, implement, generate, and use the auxiliary parameters required for secure multi-party computation in the library.Tutorial_6_Function_Secret_Sharing.ipynb- This tutorial covers function secret sharing in the library. It introduces distributed point functions, distributed comparison functions, and the process of generating and evaluating distributed interval containment functions.Tutorial_7_Neural_Network_Inference.ipynb- This tutorial explains how to implement privacy-preserving neural network inference in this library.
- csprng
Customized torchcsprng source code, as an external dependency of the library. - data Used to store the plaintext model structure code for privacy-preserving neural network inference. Other related data required by other applications can also be placed in this folder.
- debug
Test code for this project. - NssMPC
Library main source code.- application
The application package contains applications implemented using the functionalities of NssMPClib. Currently, it supports automatic conversion of plaintext cipher models and privacy-preserving neural network inference. - common
The common package includes general utilities and the basic data structures used by this lib, such as network communication, random number generators, and other tools. - config
The config package includes the basic configuration and network configuration of NssMPClib. - crypto
The crypto package is the core of the lib and includes the privacy computation primitives and protocols. - secure_model
The secure_model package includes system models and threat models used by the lib, such as the client-server model under semi-honest assumptions.
- application
- tutorials
The tutorials package contains the usage tutorials of NssMPClib.
This project is maintained by the XDU NSS lab.
NssMPClib is based on the MIT license, as described in LICENSE.
email: [email protected]