INNER CODE UNIT · Python

str_struct

MPC-SoK/frameworks · cbmc-gc/source/geninput.py:4

def str_struct(mems, vals):
    out = "{"
    for m,v in zip(mems,vals):
        out += "%s: %s;"%(m,v)
    out += "}"
    return out

def str_iv(player, val):
    return "INPUT_%s := %s;\n"%(player, val)

def gen_random_array(ll, bits=10):
    return [int(random.getrandbits(bits)) for _ in range(ll)]

# program input generation
def write_input(program, trials, gen_function):
    with open("%s/test.spec"%program, 'w') as fo:
        for t in range(trials):
            gen_function(fo)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…