/// Creates the 2-bit window table lookups for each 4-bit "chunk" in each segment of the
/// Pedersen hash.
Creates the 2-bit window table lookups for each 4-bit "chunk" in each segment of the
Pedersen hash.
Creates the 2 - bit window table lookups for each 4 - bit " chunk " in each segment of the Pedersen hash .
fn generate_pedersen_circuit_generators() -> Vec<Vec<Vec<(bls12_381::Scalar, bls12_381::Scalar)>>> {
    // Process each segment
    PEDERSEN_HASH_GENERATORS
        .iter()
        .cloned()
        .map(|mut gen| {
            let mut windows = vec![];
            for _ in 0..PEDERSEN_HASH_CHUNKS_PER_GENERATOR {
                // Create (x, y) coeffs for this chunk
                let mut coeffs = vec![];
                let mut g = gen;
                // coeffs = g, g*2, g*3, g*4
                for _ in 0..4 {
                    coeffs.push(
                        to_montgomery_coords(g.into())
                            .expect("we never encounter the point at infinity"),
                    );
                    g += gen;
                }
                windows.push(coeffs);
                // Our chunks are separated by 2 bits to prevent overlap.
                for _ in 0..4 {
                    gen = gen.double();
                }
            }
            windows
        })
        .collect()
}
fn generate_pedersen_circuit_generators ( ) -> Vec < Vec < Vec < ( bls12_381 :: Scalar , bls12_381 :: Scalar ) > > > { // Process each segment PEDERSEN_HASH_GENERATORS . iter ( ) . cloned ( ) . map ( | mut gen | { let mut windows = vec ! [ ] ; for _ in 0 .. PEDERSEN_HASH_CHUNKS_PER_GENERATOR { // Create (x, y) coeffs for this chunk let mut coeffs = vec ! [ ] ; let mut g = gen ; // coeffs = g, g*2, g*3, g*4 for _ in 0 .. 4 { coeffs . push ( to_montgomery_coords ( g . into ( ) ) . expect ( " " ) , ) ; g += gen ; } windows . push ( coeffs ) ; // Our chunks are separated by 2 bits to prevent overlap. for _ in 0 .. 4 { gen = gen . double ( ) ; } } windows } ) . collect ( ) }
Creates the 2-bit window table lookups for each 4-bit "chunk" in each segment of the
Pedersen hash.
Creates the 2 - bit window table lookups for each 4 - bit " chunk " in each segment of the Pedersen hash .