1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! A Rust implementation of secure multi-party computation (MPC) based on the paper [Global-Scale
//! Secure Multiparty Computation](https://dl.acm.org/doi/pdf/10.1145/3133956.3133979).
//!
//! This crate provides tools and protocols for performing secure computations across multiple
//! parties without revealing private inputs to other participants. The implementation uses garbled
//! circuits and other cryptographic primitives to ensure security.
//!
//! ## Features
//!
//! - Garbled circuit-based secure multi-party computation
//! - Support for both trusted dealer and untrusted preprocessing
//! - Efficient communication channels for distributed computation
//! - Boolean circuit evaluation with privacy guarantees
//!
//! ## Main Components
//!
//! The crate is structured into several modules:
//!
//! * Top-level [`polytune`](`crate`): Contains the [`mpc`] function that executes the protocol for a party.
//! * [`channel`]: Communication abstractions for exchanging data between parties.
//!
//! ## Basic Usage
//!
//! To run an MPC computation, each participating party needs to:
//!
//! 1. Set up communication channels with other parties
//! 2. Create or load a circuit definition
//! 3. Prepare private inputs
//! 4. Call the [`mpc`] function with appropriate parameters
//! 5. Process the resulting outputs
//!
//! ## Example
//!
//! ```ignore
//! use polytune::{
//! channel::SimpleChannel,
//! garble_lang::circuit::Circuit,
//! mpc,
//! };
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Set up a simple channel for communication
//! let channel= /* ... */
//!
//! // Load or define a circuit
//! let circuit = /* ... */
//!
//! // Define party roles and inputs
//! let my_inputs = vec![true, false, true];
//! let p_eval = 0; // Party 0 is the evaluator
//! let p_own = 1; // This code is running as party 1
//! let p_out = vec![0, 1]; // Parties 0 and 1 receive the output
//!
//! // Execute the MPC protocol
//! let result = mpc(
//! &channel,
//! &circuit,
//! &my_inputs,
//! p_eval,
//! p_own,
//! &p_out,
//! ).await?;
//!
//! println!("Computation result: {:?}", result);
//! # Ok(())
//! # }
//! ```
//!
//! ## Security Properties
//!
//! This implementation provides security against malicious adversaries. The protocol ensures that
//! no party learns anything beyond what can be inferred from their own inputs and the output of the
//! computation.
pub use garble_lang;
pub use ;
// TODO remove this once OT implementations are refactored and we know
// what parts we need and which not