← Return to StackOverflow.org
Transposition ciphers do not change any letters in a message, they simply rearrange them. Rectangular Transpositions start out by placing all of the letters of a message to be "encrypted" into a grid. If there are any spaces left over, they are filled with padding characters until the grid is perfectly filled. Once the grid is constructed, you "walk through it" taking letters in a particular sequence, giving you your result.
Confusing? Yeah, it is difficult to describe without an example, so here is a sample message: "Let us hear from you at once concerning jewels". If we decide to place that message into a grid that is five letters across, we end up with something like this:
L E T U S H E A R F R O M Y O U A T O N C E C O N C E R N I N G J E W E L S X X
Note the two X's at the end as padding so that the message fits in the grid. If we "walk" through the grid from left-to-right, top-to-bottom we get the following text: LHRUCCNEEEOAEEGLTAMTCRJSURYOONEXSFONNIWX
If we walk through the grid from right-to-left, top-to-bottom, we get the following text: SFONNIWXURYOONEXTAMTCRJSEEOAEEGLLHRUCCNE
We can even get tricky and alternate the horizontals so that we walk down the first column, up the next coumn, then down the following column. Repeating the direction changes to the end gives us: LHRUCCNELGEEAOEETAMTCRJSXENOOYRUSFONNIWX