fn decode_u32_precomputation(generator: RistrettoPoint) -> DecodeU32Precomputation {
    let mut hashmap = HashMap::new();

    let two12_scalar = Scalar::from(TWO14);
    let identity = RistrettoPoint::identity(); // 0 * G
    let generator = two12_scalar * generator; // 2^12 * G

    // iterator for 2^12*0G , 2^12*1G, 2^12*2G, ...
    let ristretto_iter = RistrettoIterator::new(identity, generator);
    let mut steps_for_breakpoint = 0;
    ristretto_iter.zip(0..TWO18).for_each(|(elem, x_hi)| {
        let key = elem.compress().to_bytes();
        hashmap.insert(key, x_hi);

        // unclean way to print status update; will clean up later
        if x_hi % TWO15 == 0 {
            println!("     [{:?}/8] completed", steps_for_breakpoint);
            steps_for_breakpoint += 1;
        }
    });
    println!("     [8/8] completed");

    DecodeU32Precomputation(hashmap)
}
/// Builds a HashMap of 2^18 elements
Builds a HashMap of 2^18 elements
Builds a HashMap of 2^18 elements
fn decode_u32_precomputation(generator: RistrettoPoint) -> DecodeU32Precomputation {
    let mut hashmap = HashMap::new();
    let two12_scalar = Scalar::from(TWO14);
    let identity = RistrettoPoint::identity(); // 0 * G
    let generator = two12_scalar * generator; // 2^12 * G
    // iterator for 2^12*0G , 2^12*1G, 2^12*2G, ...
    let ristretto_iter = RistrettoIterator::new(identity, generator);
    let mut steps_for_breakpoint = 0;
    ristretto_iter.zip(0..TWO18).for_each(|(elem, x_hi)| {
        let key = elem.compress().to_bytes();
        hashmap.insert(key, x_hi);
        // unclean way to print status update; will clean up later
        if x_hi % TWO15 == 0 {
            println!("     [{:?}/8] completed", steps_for_breakpoint);
            steps_for_breakpoint += 1;
        }
    });
    println!("     [8/8] completed");
    DecodeU32Precomputation(hashmap)
}
fn decode_u32_precomputation ( generator : RistrettoPoint ) -> DecodeU32Precomputation { let mut hashmap = HashMap :: new ( ) ; let two12_scalar = Scalar :: from ( TWO14 ) ; let identity = RistrettoPoint :: identity ( ) ; // 0 * G let generator = two12_scalar * generator ; // 2^12 * G // iterator for 2^12*0G , 2^12*1G, 2^12*2G, ... let ristretto_iter = RistrettoIterator :: new ( identity , generator ) ; let mut steps_for_breakpoint = 0 ; ristretto_iter . zip ( 0 .. TWO18 ) . for_each ( | ( elem , x_hi ) | { let key = elem . compress ( ) . to_bytes ( ) ; hashmap . insert ( key , x_hi ) ; // unclean way to print status update; will clean up later if x_hi % TWO15 == 0 { println ! ( " " steps_for_breakpoint ) ; steps_for_breakpoint += 1 ; } } ) ; println ! ( " " ) ; DecodeU32Precomputation ( hashmap ) }
Builds a HashMap of 2^18 elements
Builds a HashMap of 2^18 elements
generator
RistrettoPoint