(programming required) If you run your decryption program from Exercise 10.74 on Caesarciphered…
(programming required) If you run your decryption program from Exercise 10.74 on Caesarciphered text, you’ll find that your program generally doesn’t work perfectly. Write a Caesar-cipherdecrypting program that takes advantage of the fact that every letter is shifted by the same amount. Find the most probable s—the s that minimizes the difference in the probabilities of each letter from the reference text and the deciphered text. That is, minimize ∑i |f ′ i − fi+s |, where f comes from the ciphertext and f ′ comes from the reference text.
Exercise 10.74
A Caesar cipher is a special kind of substitution cipher in which the permutation π is generated by choosing a numerical shift s and moving all letters s steps forward in the alphabet, wrapping back to the beginning of the alphabet as necessary. (For example, with a shift of 5, A → F and W → B.)