Skip to content

Commit c709a49

Browse files
committed
Remove error doc
1 parent 410e6f2 commit c709a49

File tree

1 file changed

+2
-129
lines changed

1 file changed

+2
-129
lines changed

src/lib.rs

Lines changed: 2 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -14,136 +14,9 @@
1414
//!
1515
//! Thus PVSS can be used to share a secret among a group of participants so that either the secret can be reconstructed by the participants who all play fair or a participant that received a faked share can identify the malicious party.
1616
//!
17-
//! ## Build
17+
//! ## Documents
1818
//!
19-
//! ```bash
20-
//! cargo build --release
21-
//! ```
22-
//!
23-
//! ## Test
24-
//!
25-
//! ```bash
26-
//! cargo test --release
27-
//! ```
28-
//!
29-
//! ## Example
30-
//!
31-
//! ```rust
32-
//! cargo run --release --example mpvss
33-
//! ```
34-
//!
35-
//! ### Usage
36-
//!
37-
//! #### Initialization
38-
//!
39-
//! At first we convert our secret message into a numeric value if necessary. When creating the dealer a PVSS instance is created as well which holds all the global parameters that every participant needs to know.
40-
//!
41-
//! ```rust
42-
//! let secret_message = String::from("Hello MPVSS.");
43-
//! let secret = BigUint::from_bytes_be(&secret_message.as_bytes());
44-
//!
45-
//! let mut dealer = Participant::new();
46-
//! dealer.initialize();
47-
//!
48-
//! let mut p1 = Participant::new();
49-
//! let mut p2 = Participant::new();
50-
//! let mut p3 = Participant::new();
51-
//!
52-
//! p1.initialize();
53-
//! p2.initialize();
54-
//! p3.initialize();
55-
//! ```
56-
//!
57-
//! #### Distribution & Verification
58-
//!
59-
//! The dealer splits the secret into shares, encrypts them and creates a proof so that everybody can verify that the shares (once decrypted) can be used to reconstruct the secret. The threshold determines how many shares are necessary for the reconstruction. The encrypted shares and the proof are then bundled together.
60-
//!
61-
//! ```rust
62-
//! // Dealer that shares the secret among p1, p2 and p3.
63-
//! let distribute_shares_box = dealer.distribute_secret(
64-
//! secret.to_bigint().unwrap(),
65-
//! vec![p1.publickey, p2.publickey, p3.publickey],
66-
//! 3,
67-
//! );
68-
//!
69-
//! // p1 verifies distribution shares box containing encryted shares and proof of zero-knowlege. [p2 and p3 do this as well.]
70-
//! assert_eq!(
71-
//! p1.mpvss.verify_distribution_shares(&distribute_shares_box),
72-
//! true
73-
//! );
74-
//! assert_eq!(
75-
//! p2.mpvss.verify_distribution_shares(&distribute_shares_box),
76-
//! true
77-
//! );
78-
//! assert_eq!(
79-
//! p3.mpvss.verify_distribution_shares(&distribute_shares_box),
80-
//! true
81-
//! );
82-
//! ```
83-
//!
84-
//! #### Exchange & Verification
85-
//!
86-
//! The participants extract their shares from the distribution shares box and decrypt them. They bundle them together with a proof that allows the receiver to verify that the share is indeed the result of the decryption.
87-
//!
88-
//! ```rust
89-
//! // p1 extracts the share. [p2 and p3 do this as well.]
90-
//! let s1 = p1
91-
//! .extract_secret_share(&distribute_shares_box, &p1.privatekey)
92-
//! .unwrap();
93-
//!
94-
//! // p1, p2 and p3 exchange their descrypted shares.
95-
//! // ...
96-
//! let s2 = p2
97-
//! .extract_secret_share(&distribute_shares_box, &p2.privatekey)
98-
//! .unwrap();
99-
//! let s3 = p3
100-
//! .extract_secret_share(&distribute_shares_box, &p3.privatekey)
101-
//! .unwrap();
102-
//!
103-
//! // p1 verifies the share received from p2. [Actually everybody verifies every received share.]
104-
//! assert_eq!(
105-
//! p1.mpvss
106-
//! .verify(&s2, &distribute_shares_box.shares[&p2.publickey]),
107-
//! true
108-
//! );
109-
//! assert_eq!(
110-
//! p2.mpvss
111-
//! .verify(&s3, &distribute_shares_box.shares[&p3.publickey]),
112-
//! true
113-
//! );
114-
//! assert_eq!(
115-
//! p3.mpvss
116-
//! .verify(&s1, &distribute_shares_box.shares[&s1.publickey]),
117-
//! true
118-
//! );
119-
//! ```
120-
//!
121-
//! #### Reconstruction
122-
//!
123-
//! Once a participant collected at least `threshold` shares the secret can be reconstructed.
124-
//!
125-
//! ```rust
126-
//! let share_boxs = [s1, s2, s3];
127-
//! let r1 = p1
128-
//! .mpvss
129-
//! .reconstruct(&share_boxs, &distribute_shares_box)
130-
//! .unwrap();
131-
//! let r2 = p2
132-
//! .mpvss
133-
//! .reconstruct(&share_boxs, &distribute_shares_box)
134-
//! .unwrap();
135-
//! let r3 = p3
136-
//! .mpvss
137-
//! .reconstruct(&share_boxs, &distribute_shares_box)
138-
//! .unwrap();
139-
//!
140-
//! let r1_str = String::from_utf8(r1.to_biguint().unwrap().to_bytes_be()).unwrap();
141-
//! assert_eq!(secret_message.clone(), r1_str);
142-
//! let r2_str = String::from_utf8(r2.to_biguint().unwrap().to_bytes_be()).unwrap();
143-
//! assert_eq!(secret_message.clone(), r2_str);
144-
//! let r3_str = String::from_utf8(r3.to_biguint().unwrap().to_bytes_be()).unwrap();
145-
//! assert_eq!(secret_message.clone(), r3_str);
146-
//! ```
19+
//! See [Github README](https://github.com/AlexiaChen/mpvss-rs/blob/master/README.md)
14720
14821
mod dleq;
14922
mod mpvss;

0 commit comments

Comments
 (0)