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) )
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)