Skip to content

Commit

Permalink
Fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
survived committed Jun 19, 2024
1 parent 88e38d2 commit a97f479
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 30 deletions.
11 changes: 5 additions & 6 deletions src/group_element_vs_paillier_encryption_in_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Prover and verifier have a shared protocol state
//! let shared_state_prover = sha2::Sha256::default();
//! let shared_state_verifier = sha2::Sha256::default();
//! let shared_state = "some shared state";
//! let mut rng = rand_core::OsRng;
//! # let mut rng = rand_dev::DevRng::new();
//!
Expand Down Expand Up @@ -69,8 +68,8 @@
//! b: &Point::<E>::generator().into(),
//! };
//! let (commitment, proof) =
//! p::non_interactive::prove(
//! shared_state_prover,
//! p::non_interactive::prove::<E, sha2::Sha256>(
//! &shared_state,
//! &aux,
//! data,
//! p::PrivateData { x: &x, nonce: &nonce },
Expand All @@ -87,8 +86,8 @@
//!
//! # let recv = || (data, commitment, proof);
//! let (data, commitment, proof) = recv();
//! p::non_interactive::verify(
//! shared_state_verifier,
//! p::non_interactive::verify::<E, sha2::Sha256>(
//! &shared_state,
//! &aux,
//! data,
//! &commitment,
Expand Down
11 changes: 5 additions & 6 deletions src/no_small_factor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
//! # }
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let shared_state_prover = sha2::Sha256::default();
//! let shared_state_verifier = sha2::Sha256::default();
//! let shared_state = "some shared state";
//! let mut rng = rand_core::OsRng;
//! # let mut rng = rand_dev::DevRng::new();
//!
Expand All @@ -49,13 +48,13 @@
//!
//! // 2. Prover computes a non-interactive proof that both factors are large enough
//!
//! let proof = p::prove(
//! shared_state_prover,
//! let proof = p::prove::<sha2::Sha256>(
//! &shared_state,
//! &aux,
//! data,
//! p::PrivateData { p: &p, q: &q },
//! &security,
//! rng,
//! &mut rng,
//! )?;
//!
//! // 4. Prover sends this data to verifier
Expand All @@ -72,7 +71,7 @@
//! n: &n,
//! n_root: &n_root,
//! };
//! p::verify(shared_state_verifier, &aux, data, &security, &proof)?;
//! p::verify::<sha2::Sha256>(&shared_state, &aux, data, &security, &proof)?;
//! # Ok(()) }
//! ```
//!
Expand Down
11 changes: 5 additions & 6 deletions src/paillier_affine_operation_in_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Prover and verifier have a shared protocol state
//! let shared_state_prover = sha2::Sha256::default();
//! let shared_state_verifier = sha2::Sha256::default();
//! let shared_state = "some shared state";
//!
//! let mut rng = rand_core::OsRng;
//! # let mut rng = rand_dev::DevRng::new();
Expand Down Expand Up @@ -122,8 +121,8 @@
//! nonce_y: &nonce_y,
//! };
//! let (commitment, proof) =
//! p::non_interactive::prove(
//! shared_state_prover,
//! p::non_interactive::prove::<E, sha2::Sha256>(
//! &shared_state,
//! &aux,
//! data,
//! pdata,
Expand All @@ -141,8 +140,8 @@
//!
//! # let recv = || (data, commitment, proof);
//! let (data, commitment, proof) = recv();
//! let r = p::non_interactive::verify(
//! shared_state_verifier,
//! let r = p::non_interactive::verify::<E, sha2::Sha256>(
//! &shared_state,
//! &aux,
//! data,
//! &commitment,
Expand Down
11 changes: 5 additions & 6 deletions src/paillier_blum_modulus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@
//! // Security parameter
//! const SECURITY: usize = 33;
//! // Verifier and prover share the same state
//! let prover_shared_state = sha2::Sha256::default();
//! let verifier_shared_state = sha2::Sha256::default();
//! let shared_state = "some shared state";
//!
//! let data = p::Data { n };
//! let pdata = p::PrivateData { p, q };
//!
//! let (commitment, proof) =
//! p::non_interactive::prove::<{SECURITY}, _, _>(
//! prover_shared_state,
//! p::non_interactive::prove::<{SECURITY}, sha2::Sha256>(
//! &shared_state,
//! &data,
//! &pdata,
//! &mut rng,
Expand All @@ -47,8 +46,8 @@
//! # let recv = || (data, commitment, proof);
//! let (data, commitment, proof) = recv();
//!
//! p::non_interactive::verify::<{SECURITY}, _>(
//! verifier_shared_state,
//! p::non_interactive::verify::<{SECURITY}, sha2::Sha256>(
//! &shared_state,
//! &data,
//! &commitment,
//! &proof,
Expand Down
11 changes: 5 additions & 6 deletions src/paillier_encryption_in_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
//! # }
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//!
//! let shared_state_prover = sha2::Sha256::default();
//! let shared_state_verifier = sha2::Sha256::default();
//! let shared_state = "some shared state";
//!
//! let mut rng = rand_core::OsRng;
//! # let mut rng = rand_dev::DevRng::new();
Expand Down Expand Up @@ -53,8 +52,8 @@
//! // 3. Prover computes a non-interactive proof that plaintext is at most 1024 bits:
//!
//! let data = p::Data { key, ciphertext: &ciphertext };
//! let (commitment, proof) = p::non_interactive::prove(
//! shared_state_prover,
//! let (commitment, proof) = p::non_interactive::prove::<sha2::Sha256>(
//! &shared_state,
//! &aux,
//! data,
//! p::PrivateData {
Expand All @@ -74,8 +73,8 @@
//!
//! # let recv = || (data, commitment, proof);
//! let (data, commitment, proof) = recv();
//! p::non_interactive::verify(
//! shared_state_verifier,
//! p::non_interactive::verify::<sha2::Sha256>(
//! &shared_state,
//! &aux,
//! data,
//! &commitment,
Expand Down

0 comments on commit a97f479

Please sign in to comment.