Page 316 - Discrete Mathematics and Its Applications
P. 316

4.6 Cryptography  295

                                      EXAMPLE 1      What is the secret message produced from the message “MEET YOU IN THE PARK” using
                                                     the Caesar cipher?

                                                     Solution: First replace the letters in the message with numbers. This produces

                                                        12 4 4 19   24 14 20    8 13    19 7 4   15 0 17 10.

                                                     Now replace each of these numbers p by f(p) = (p + 3) mod 26. This gives

                                                        157722      11723      1116     22 10 7   18320 13.

                                                     Translating this back to letters produces the encrypted message “PHHW BRX LQ WKH
                                                     SDUN.”                                                                         ▲

                                                        To recover the original message from a secret message encrypted by the Caesar cipher, the
                                                     function f  −1 , the inverse of f , is used. Note that the function f  −1  sends an integer p from
                                                     Z 26 ,to f  −1 (p) = (p − 3) mod 26. In other words, to find the original message, each letter is
                                                     shifted back three letters in the alphabet, with the first three letters sent to the last three letters
                                                     of the alphabet. The process of determining the original message from the encrypted message
                                                     is called decryption.
                                                        There are various ways to generalize the Caesar cipher. For example, instead of shifting the
                                                     numerical equivalent of each letter by 3, we can shift the numerical equivalent of each letter by
                                                     k, so that

                                                        f(p) = (p + k) mod 26.

                                                     Such a cipher is called a shift cipher. Note that decryption can be carried out using

                                                        f −1 (p) = (p − k) mod 26.

                                                     Here the integer k is called a key. We illustrate the use of a shift cipher in Examples 2 and 3.

                                      EXAMPLE 2      Encrypt the plaintext message “STOP GLOBAL WARMING” using the shift cipher with shift
                                                     k = 11.

                                                     Solution: To encrypt the message “STOP GLOBAL WARMING” we first translate each letter
                                                     to the corresponding element of Z 26 . This produces the string
                                                        18 19 14 15   6 11 14 1 0 11   22 0 17 12 8 13 6.


                                                        We now apply the shift f(p) = (p + 11) mod 26 to each number in this string. We obtain
                                                        3425 0     172225121122        7 11 223192417.

                                                     Translating this last string back to letters, we obtain the ciphertext “DEZA RWZMLW HLCX-
                                                     TYR.”                                                                          ▲


                                      EXAMPLE 3      Decrypt the ciphertext message “LEWLYPLUJL PZ H NYLHA ALHJOLY” that was en-
                                                     crypted with the shift cipher with shift k = 7.

                                                     Solution: To decrypt the ciphertext “LEWLYPLUJL PZ H NYLHA ALHJOLY” we first
                                                     translate the letters back to elements of Z 26 . We obtain

                                                        11 4221124151120 9 11       15 25    7    13241170       0 1179141124.
   311   312   313   314   315   316   317   318   319   320   321