예제 #1
0
파일: simple.py 프로젝트: hellman/cry
def concat(funcs):
    assert len(set(f.input_size() for f in funcs)) == 1
    sizes = tuple(f.output_size() for f in funcs)
    return SBox2(
        [Bin.concat(*Bin.array(ys, ns=sizes)) for ys in zip(*funcs)],
        m=sum(sizes)
    )
예제 #2
0
 def __getitem__(self, lst):
     assert len(lst) == self.num_in
     x = Bin.concat(Bin.array(lst, n=self.width_in))
     y = self.s[x]
     return Bin(y, self.width_out).split(parts=self.num_out)