moves verify.rs to examples and adds comments about safety

This commit is contained in:
Kobi Gurkan 2020-04-27 14:02:37 +03:00 committed by poma
parent 9098e203ea
commit 72a2111e03
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657
3 changed files with 7 additions and 3 deletions

@ -104,7 +104,7 @@ pub fn merge_pairs<G: CurveAffine>(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);

@ -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};

@ -27,7 +27,7 @@ pub fn calculate_hash(input_map: &Mmap) -> GenericArray<u8, U64> {
}
/// 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<E: Engine>(mut digest: &[u8]) -> E::G2 {
assert!(digest.len() >= 32);