Exemplo n.º 1
0
def do_mix(mixfile, newfile, nr_rounds, nr_parallel):
    if exists(newfile):
        m = "file '%s' already exists, will not overwrite" % (newfile,)
        raise ValueError(m)

    with open(mixfile) as f:
        mix = from_canonical(f)

    new_mix = mix_ciphers(mix, nr_rounds=nr_rounds,
                          nr_parallel=nr_parallel)
    with open(newfile, "w") as f:
        to_canonical(new_mix, out=f)

    return new_mix
Exemplo n.º 2
0
 def mix(self, ciphers):
   return mix_ciphers(ciphers, teller=self.teller,
                         nr_rounds=MIXNET_NR_ROUNDS,
                        nr_parallel=self.get_option('parallel'))