zisk-precomp-common 1.1.0-alpha

Common utilities and helpers for ZisK precompiles
use proofman_fields::Goldilocks;

/*
    # List of generators of groups of size power of 2
    p = 2^64 - 2^32 + 1
    F = GF(p)
    a = F(7) # a = F.multiplicative_generator()
    for i in range(33):
        g = a^((p-1)/2^i)
        assert(g.multiplicative_order() == 2^i)
        print(g, end=",")
*/
pub const GOLDILOCKS_GEN: [u64; 33] = [
    1,
    18446744069414584320,
    281474976710656,
    18446744069397807105,
    17293822564807737345,
    70368744161280,
    549755813888,
    17870292113338400769,
    13797081185216407910,
    1803076106186727246,
    11353340290879379826,
    455906449640507599,
    17492915097719143606,
    1532612707718625687,
    16207902636198568418,
    17776499369601055404,
    6115771955107415310,
    12380578893860276750,
    9306717745644682924,
    18146160046829613826,
    3511170319078647661,
    17654865857378133588,
    5416168637041100469,
    16905767614792059275,
    9713644485405565297,
    5456943929260765144,
    17096174751763063430,
    1213594585890690845,
    6414415596519834757,
    16116352524544190054,
    9123114210336311365,
    4614640910117430873,
    1753635133440165772,
];

// K = 7^(2^32) => Generator of the group of size (p-1)/2^32 = 3·5·17·257·65537
pub const GOLDILOCKS_K: u64 = 12275445934081160404;

pub fn get_ks(k: Goldilocks, n: usize) -> Vec<Goldilocks> {
    let mut ks = vec![k];
    for i in 1..n {
        ks.push(ks[i - 1] * k);
    }
    ks
}