Skip to content

Commit

Permalink
refactor: get random g1 vec method on PublicParameters for pub use in…
Browse files Browse the repository at this point in the history
… sxt-db

fmt

revert function name change
  • Loading branch information
Dustin-Ray committed Oct 2, 2024
1 parent 22e06ae commit 78b4c33
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/proof-of-sql/src/proof_primitive/dory/public_parameters.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::{G1Affine, G2Affine};
use alloc::vec::Vec;
use ark_ff::UniformRand;
/// The public parameters for the Dory protocol. See section 5 of https://eprint.iacr.org/2020/1274.pdf for details.
///
/// Note: even though H_1 and H_2 are marked as blue, they are still needed.
Expand Down Expand Up @@ -41,4 +42,14 @@ impl PublicParameters {
Gamma_2_fin,
}
}

/// Creates two vectors of random G1 and G2 elements with length 2^nu.
pub fn get_rand_G_vecs<R>(nu: usize, rng: &mut R) -> (Vec<G1Affine>, Vec<G2Affine>)
where
R: ark_std::rand::Rng + ?Sized,
{
core::iter::repeat_with(|| (G1Affine::rand(rng), G2Affine::rand(rng)))
.take(1 << nu)
.unzip()
}
}

0 comments on commit 78b4c33

Please sign in to comment.