All problems
Columnar Cipher Decrypt
Problem
Decrypt a columnar transposition cipher. The plaintext was written row by row into `columns` columns, then the columns were read in the order given by order, where order[read_index] is the column read at that position. The ciphertext length is divisible by columns. Return the plaintext string.
Hint
Split the ciphertext into chunks of one column height and place each chunk in the column it was read from.
Test cases
case 1
in: ["LRHWLLEOOD",5,[2,0,3,1,4]]
expected: "HELLOWORLD"
case 2
in: ["TKAATNACDTAW",4,[1,3,0,2]]
expected: "ATTACKATDAWN"
case 3
in: ["CFADBE",3,[2,0,1]]
expected: "ABCDEF"
Starter codePython
def columnar_decrypt(ciphertext, columns, order):
# Your code here
pass3 test cases · run your code against them in the editor