CIS 554 Scala 4: Caesar Cipher
Fall 2016, David Matuszek

Purposes of this assignment

General idea

The Caesar cipher is one of the oldest encryption techniques, and certainly one of the easiest to break.

The idea of a Caesar cipher is this: you encode a message by shifting each letter some number of places. Thus, if the shift is 2, then A becomes C, B becomes D, and so on. It is end around, so Y becomes A and Z becomes B. Like this:

letter-shift

For an accurate Caesar cipher, we would discard all punctuation, and group the text into blocks of five letters. We won't do that here; we will retain all spacing and punctuation, and all capitalization. This will enable us to decipher messages to get exactly the original message.

Details

Name your project Caesar, and your package cipher. Create an object Cipher (in this assignment, you don't need classes) containing at least the following two methods:
def encipher(shift: Int, plainText: String): String
Enciphers the message, using the shift. Allow the shift to be any integer value; use the mod operator to cut it down to a value between 0 and 25.
def decipher(cipheredText: String): (Int, String)
Given any message enciphered using a Caesar cipher, decipher it and return the shift (0..25) that was used, and the deciphered message.
You may provide a main method if you feel like it, but it isn't required.

Testing

Write unit tests for the above methods, and for any other I/O free methods you write.

How to do it

A message will be correctly deciphered when it consists of mostly English words. It doesn't have to be entirely English words-that's too strict a test. The message may contain other things, such as the names of people or places.

Remember that you used a very large list of English words in the Jotto assignment.

Due date

Zip your Scala project and turn the zip file in to Canvas. Due by 11:59pm Tuesday, November 29.