From 72a2111e03b0c8ecb1a1e25977b818aaefad06ba Mon Sep 17 00:00:00 2001 From: Kobi Gurkan Date: Mon, 27 Apr 2020 14:02:37 +0300 Subject: [PATCH] moves verify.rs to examples and adds comments about safety --- phase2/src/utils.rs | 4 ++-- powersoftau/{src/bin => examples}/verify.rs | 4 ++++ powersoftau/src/utils.rs | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) rename powersoftau/{src/bin => examples}/verify.rs (98%) diff --git a/phase2/src/utils.rs b/phase2/src/utils.rs index 0cfc903..243f2b6 100644 --- a/phase2/src/utils.rs +++ b/phase2/src/utils.rs @@ -104,7 +104,7 @@ pub fn merge_pairs(v1: &[G], v2: &[G]) -> (G, G) /// Hashes to G2 using the first 32 bytes of `digest`. Panics if `digest` is less -/// than 32 bytes. +/// than 32 bytes. The input must be random. pub fn hash_to_g2(mut digest: &[u8]) -> G2 { assert!(digest.len() >= 32); @@ -179,4 +179,4 @@ pub fn pairing_to_vec(p: &Fq12) -> Vec>> { ] ], ] -} \ No newline at end of file +} diff --git a/powersoftau/src/bin/verify.rs b/powersoftau/examples/verify.rs similarity index 98% rename from powersoftau/src/bin/verify.rs rename to powersoftau/examples/verify.rs index 0478f19..64943e2 100644 --- a/powersoftau/src/bin/verify.rs +++ b/powersoftau/examples/verify.rs @@ -1,3 +1,7 @@ +//! verify.rs has multiple problems and shouldn't be used in production without further changes. +//! Specifically, it doesn't verify the hash chain from each of the contributions and it has a +//! hardcoded number of participants. + use bellman_ce::pairing::bn256::Bn256; use bellman_ce::pairing::bn256::{G1, G2}; use bellman_ce::pairing::{CurveAffine, CurveProjective}; diff --git a/powersoftau/src/utils.rs b/powersoftau/src/utils.rs index 5edcc2f..8f032c6 100644 --- a/powersoftau/src/utils.rs +++ b/powersoftau/src/utils.rs @@ -27,7 +27,7 @@ pub fn calculate_hash(input_map: &Mmap) -> GenericArray { } /// Hashes to G2 using the first 32 bytes of `digest`. Panics if `digest` is less -/// than 32 bytes. +/// than 32 bytes. The input must be random. pub fn hash_to_g2(mut digest: &[u8]) -> E::G2 { assert!(digest.len() >= 32);