We shall view Rectangular Transposition in a slightly different manner than we did originally. We assume that the sender and receiver choose a secret period `p` and a secret permutation of length `p`, say `a=(a _{1},a_{2},...,a_{p})` where each

To break Rectangular Transposition encryption, one guesses a period `p` and then, uses the given matrix of statistics to determine the validity of `p` according to the following cases

- All the entries in the matrix are approximately the same
- Each row except one has a maximum that is much larger than all the other entries in the row. Similarly, each column except one has a maximum that is much larger than all the other entries in the column.

The Applet below is programmed to illustrate this codebreaking process.

- Upon pressing the
*Random Cyphertext*button, the Applet will display some text which is Rectangular Transposition encrypted by a randomly selected key. - Press the
*Break*button to start the process. The Applet assumes (most often incorrectly) that`p=2`. Thus it proceeds as if every pair of letters of plaintext was encrypted by reversing the order of the pair. It displays the matrix of statistics and a visual representation of the permutation. - Press the
*Period +*several times (if necessary) until an appropriate value of`p`is obtained. Of course, an appropriate value is found according to the above criteria. - Now click in the cells of the matrix that contain the largest value in each row. Arrows will be drawn on the permutation to help keep track of it. For instance, after clicking in the
`i`^{th}row and`j`^{th}column, an arrow is drawn from`i`to`j`to indicate that the`i`^{th}letter of cyphertext was most likely followed by the`j`^{th}letter of cyphertext. - Now you may press the
*Decrypt*button. The Applet will then decrypt the given cyphertext as if it was encrypted by means of the values of`a`you have just determined. A look at the resulting text will make it clear if all of your guesses were correct or which, if any, need to be changed._{1},a_{2},...,a_{p}