fn check_consistency_of_pedersen_hash_generators(
    pedersen_hash_generators: &[jubjub::SubgroupPoint],
) {
    for (i, p1) in pedersen_hash_generators.iter().enumerate() {
        if p1.is_identity().into() {
            panic!("Neutral element!");
        }
        for p2 in pedersen_hash_generators.iter().skip(i + 1) {
            if p1 == p2 {
                panic!("Duplicate generator!");
            }
            if *p1 == -p2 {
                panic!("Inverse generator!");
            }
        }

        // check for a generator being the sum of any other two
        for (j, p2) in pedersen_hash_generators.iter().enumerate() {
            if j == i {
                continue;
            }
            for (k, p3) in pedersen_hash_generators.iter().enumerate() {
                if k == j || k == i {
                    continue;
                }
                let sum = p2 + p3;
                if sum == *p1 {
                    panic!("Linear relation between generators!");
                }
            }
        }
    }
}
/// Check for simple relations between the generators, that make finding collisions easy;
/// far worse than spec inconsistencies!
Check for simple relations between the generators, that make finding collisions easy;
far worse than spec inconsistencies!
Check for simple relations between the generators that make finding collisions easy ; far worse than spec inconsistencies!
fn check_consistency_of_pedersen_hash_generators(
    pedersen_hash_generators: &[jubjub::SubgroupPoint],
) {
    for (i, p1) in pedersen_hash_generators.iter().enumerate() {
        if p1.is_identity().into() {
            panic!("Neutral element!");
        }
        for p2 in pedersen_hash_generators.iter().skip(i + 1) {
            if p1 == p2 {
                panic!("Duplicate generator!");
            }
            if *p1 == -p2 {
                panic!("Inverse generator!");
            }
        }
        // check for a generator being the sum of any other two
        for (j, p2) in pedersen_hash_generators.iter().enumerate() {
            if j == i {
                continue;
            }
            for (k, p3) in pedersen_hash_generators.iter().enumerate() {
                if k == j || k == i {
                    continue;
                }
                let sum = p2 + p3;
                if sum == *p1 {
                    panic!("Linear relation between generators!");
                }
            }
        }
    }
}
fn check_consistency_of_pedersen_hash_generators ( pedersen_hash_generators : & [ jubjub :: SubgroupPoint ] , ) { for ( i , p1 ) in pedersen_hash_generators . iter ( ) . enumerate ( ) { if p1 . is_identity ( ) . into ( ) { panic ! ( " " ) ; } for p2 in pedersen_hash_generators . iter ( ) . skip ( i + 1 ) { if p1 == p2 { panic ! ( " " ) ; } if * p1 == - p2 { panic ! ( " " ) ; } } // check for a generator being the sum of any other two for ( j , p2 ) in pedersen_hash_generators . iter ( ) . enumerate ( ) { if j == i { continue ; } for ( k , p3 ) in pedersen_hash_generators . iter ( ) . enumerate ( ) { if k == j || k == i { continue ; } let sum = p2 + p3 ; if sum == * p1 { panic ! ( " " ) ; } } } } }
Check for simple relations between the generators, that make finding collisions easy;
far worse than spec inconsistencies!
Check for simple relations between the generators that make finding collisions easy ; far worse than spec inconsistencies!
pedersen_hash_generators
&[jubjub::SubgroupPoint]
pedersen_hash_generators
&[jubjub::SubgroupPoint]