- untransposed_rows = [untranspose(r, transpositions) for r in rows]
- columns = zip(*untransposed_rows)
- rotated_columns = [col[-start:] + col[:-start] for start, col in zip([keycolumn[l] for l in keyword], columns)]
- rotated_rows = zip(*rotated_columns)
- # return rotated_columns
- return cat(chain(*rotated_rows))
+ deciphered_chunks = []
+ for message_chunk in chunks(message, len(transpositions) * 25,
+ fillvalue=fillvalue):
+ rows = chunks(message_chunk, len(transpositions), fillvalue=fillvalue)
+ untransposed_rows = [untranspose(r, transpositions) for r in rows]
+ columns = zip(*untransposed_rows)
+ rotated_columns = [col[-start:] + col[:-start] for start, col in zip([keycolumn[l] for l in keyword], columns)]
+ rotated_rows = zip(*rotated_columns)
+ deciphered_chunks.append(cat(chain(*rotated_rows)))
+ return cat(deciphered_chunks)
+