Chapter 8 – The Transposition Cipher, Encrypting 117
ciphertext[col] (and since col is 0 on the first time through the loop, this is
ciphertext[0]).
Figure 8- 2. Arrows pointing to what message[pointer] refers to during the first iteration of
the for loop when col is set to 0.
Figure 8- 2 shows the characters at these indexes, they will be concatenated together to form the
string 'Ceno'. Remember that we want the value in ciphertext to eventually look like this:
ciphertext = ['Ceno', 'onom', 'mstm', 'me o', 'o sn', 'nio.', ' s ', 's c']
ciphertext[0]
'Ceno'
Storing 'Ceno' as the first string in the ciphertext list is our first step.
On the next iteration of the for loop, col will be set to 1 (instead of 0 ) and pointer will start
at the same value as col. Now when we add 8 to pointer on each iteration of line 30’s
while loop, the indexes will be 1 , 9 , 17 , and 25.
Figure 8- 3. Arrows pointing to to what message[pointer] refers to during the second
iteration of the for loop when col is set to 1.
As message[1], message[9], message[17], and message[25] are concatenated to the
end of ciphertext[1], they form the string 'onom'. This is the second column of our grid.