Of course, one could increase the security of an an affine cipher using a different one on each letter, as the Vigenère cipher discussed in section 4 does. But this is extra effort with no payoff: such a cipher can be cracked by exactly the same methods, and it is more work to encipher.
However, because an affine cipher sends adjacent letters far apart, one way to improve the cipher is to work on multiple letters at a time, either in pairs, triplets, or larger groupings. Instead of assigning numbers to individual letters, we think of our message as made up of ``super-characters'', where each individual letter gives us one ``digit'' of the group.
For example, if we wanted our super-characters to be made up of pairs of two letters (called a digraph), we would think of the plaintext double as being made up of the three pairs of digraphs do, ub, and le. How many pairs of such digraphs do we have? Since we have 26 choices for the first letter and 26 for the second, there are 26 x 26 = 676 such pairs. The first one is aa and gets assigned the number 0, ab gets 1, ac has the code 2, and so on, up to zz which gets the character code 675. If the plaintext has an odd number of characters, we add an additional character onto the end (usually x, q, or z).
With so many digraphs, we certainly don't want to have to use a table
to look up the numeric equivalences. But notice that we can readily
figure out which letter pair gets which number by paying attention to
place value. Remember that when we write the decimal number for
six hundred seventy five, we write
Let's encrypt the word blue using the same affine cipher as in section 6 (that is, with m=3 and b=20), but working with digraphs.
|x||1 x 26 + 11=37||20 x 26 + 4 = 524|
|131 = 5 x 26 + 1||240 = 9 x 26 + 6|
Note that we can take m to be any number between 1 and 675 (as long as it is relatively prime to 26), and we can take b as anything between 0 and 675.
To break such a code, we can apply frequency analysis, but this time we must look at frequency of pairs of letters. This is still doable, but more challenging.
Notice that we can just as well use triplets of letters (trigraphs), or blocks of any length we choose. For example, if we were using 4-tuples, the word blue would be a single ``character'' and would have the numeric code