EXAMPLE 14 Linear Cipher
To illustrate a linear cipher, we encrypt the message ADVANCE using the formula 21x+7 and decrypt the message ANQANHQ that was encrypted using the formula 21x+7.
Message | A | D | V | A | N | C | E |
Position | 0 | 3 | 21 | 0 | 13 | 2 | 4 |
Position ×21+7 | 7 | 70 | 448 | 7 | 280 | 49 | 91 |
New position | 7 | 18 | 6 | 7 | 20 | 23 | 13 |
Encrypted message | H | S | G | H | N | X | E |
To decrypt ANQANHQ, we see from Table 17.4 that the decryption value for 21 is 5, so our decryption formula is 5(x−7)=5x−35. To make calculations easier, it is better to replace −35 by a positive integer by observing that when using modulo 26, we may add 26 to any integer without changing the value. Thus, −35=−35+26=−9=−9+26=17, and our formula becomes 5x+17. (Or use Google to obtain —35 mod 26=17.)
Message | A | N | Q | A | N | H | Q |
Position | 0 | 13 | 16 | 0 | 13 | 7 | 16 |
Position ×5+17 | 17 | 82 | 97 | 17 | 82 | 52 | 97 |
New position | 17 | 4 | 19 | 17 | 4 | 0 | 19 |
Decrypted message | R | E | T | R | E | A | T |