What if a message does not fill the final row of a columnar grid? Try MEETATGATE with key BIRD: ten letters across four columns leave two cells empty. Those blanks affect column lengths, so we need to account for them before decoding.
1. Fill rows under the key
| Position | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| Key | B | I | R | D |
| Row 1 | M | E | E | T |
| Row 2 | A | T | G | A |
| Row 3 | T | E | — | — |
| Length | 3 | 3 | 2 | 2 |
The dashes mark empty cells in the table; they are not message characters. There is no need to add X, spaces, or any other padding.
2. Read columns in key order
| Read order | Key letter | Original position | Letters |
|---|---|---|---|
| 1 | B | 1 | MAT |
| 2 | D | 4 | TA |
| 3 | I | 2 | ETE |
| 4 | R | 3 | EG |
The ten-letter output
MEETATGATEKey BIRD; alphabetical order B, D, I, R; no paddingMATTAETEEG3. Split by the original lengths
The key gives read order 1, 4, 2, 3, with column lengths 3, 2, 3, 2. Split MATTAETEEG into MAT | TA | ETE | EG. Put these pieces under B, D, I, and R, keeping each piece in top-to-bottom order.
4. Read the rows again
Return the columns to B, I, R, D order. Read across to get MEET, then ATGA, then TE: MEETATGATE. Any spaces removed before encoding are still absent; the grid only tells us the order of the letters.
Your turn
Keep the same key BIRD but use ABCDEFGHI. What are the four original column lengths?