Hacking Secret Ciphers with Python

(Ann) #1
Chapter 9 – The Transposition Cipher, Decrypting 125

Then start filling in the boxes with one character of the ciphertext per box. Start at the top left and
go right, just like we did when we were encrypting. The ciphertext is “Cenoonommstmme oo
snnio. s s c”, and so “Ceno” goes in the first row, then “onom” in the second row, and so on.
After we are done, the boxes will look like this (where the (s) represents a space):


C e n o
o n o m
m s t m
m e (s) o
o (s) s n
n i o.
(s) s (s)
s (s) c

Our friend who received the ciphertext will see that if she reads the text going down the columns,
the original plaintext has been restored: “Common sense is not so common.”


The steps for decrypting are:



  1. Calculate the number of columns you will have by taking the length of the message and
    dividing by the key, then rounding up.

  2. Draw out a number of boxes. The number of columns was calculated in step 1. The
    number of rows is the same as the key.

  3. Calculate the number of boxes to shade in by taking the number of boxes (this is the
    number of rows and columns multiplied) and subtracting the length of the ciphertext
    message.

  4. Shade in the number of boxes you calculated in step 3 at the bottom of the rightmost
    column.

  5. Fill in the characters of the ciphertext starting at the top row and going from left to right.
    Skip any of the shaded boxes.

  6. Get the plaintext by reading from the leftmost column going from top to bottom, and
    moving over to the top of the next column.


Note that if you use a different key, you will be drawing out the wrong number of rows. Even if
you follow the other steps in the decryption process correctly, the plaintext will come out looking
like random garbage (just like when you use the wrong key with the Caesar cipher).


Practice Exercises, Chapter 9, Set A


Practice exercises can be found at http://invpy.com/hackingpractice 9 A.

Free download pdf