CSS 220 Module 4 Homework
Think about how many messages are sent electronically today. What are most common? Email, text messages, in-app messaging? And what kind of data gets sent? Is it secure? For it to be secure during transmission, it needs to be encrypted. Do you know if your messages are encrypted? It is not hard to do. Let’s work through some classic encryption techniques.
Then when it arrives and the receiver wants to look at your message, they can perform a decryption. All forms of encryption rely on two basic forms of ciphers: substitution-based and transposition-based. Good encryption algorithms actually use multiple layers of both cipher forms. Let’s look at each form in more detail.
Have you ever seen the cryptoquote puzzles in the newspaper? You can try to solve one here: https://api.razzlepuzzles.com/cryptogram.
Despite its daunting name, the substitution-based cipher is actually a fairly simple encryption technique. A substitution-based cipher replaces a character or group of characters with a different character or group of characters. Consider the following simple example. Each letter in the plaintext row maps onto the letter below it in the ciphertext row.
This ciphertext simply corresponds to the letters on a keyboard, scanning right to left, top to bottom. To send a message using this encoding scheme, each plaintext letter of the message is replaced with the ciphertext character directly below it. Thus, the message
what are you doing after class?
would encode to
VEPMP STXGN UGWHR PTMYS IKPAA
A space has been placed after every five ciphertext characters to help disguise obvious patterns.
1. Using the above plaintext and corresponding ciphertext, encode the message “i will encrypt everything”.
A famous substitution cipher is the Caesar Cipher, created and used by Julius Caesar. This cipher uses what is called a shift technique. Similar to above, you will make substitutions, but is a bit easier to code and decode. The transformation can be represented by aligning two alphabets; the cipher alphabet is the plain alphabet shifted left or right by some number of positions (the key).
For instance: Key = left shift 7 spaces
2. Create your own message and encode it using the Caesar Cipher method. Provide your key to decode the message.
A transposition-based cipher is different from a substitution-based cipher in that the order of the plaintext is not preserved. Rearranging the order of the plaintext characters makes common patterns unclear and the code much more difficult to break. Let us consider a simple example of a transposition cipher. Choose a keyword that contains no duplicate letters, such as COMPUTER. Over each letter in the keyword, write the number that corresponds to the order in which that letter appears in the alphabet when compared to the other letters in the keyword. For the keyword COMPUTER, C appears first in the alphabet, E is second, M is third, O is fourth, and so on.
Take a plaintext message such as “this is the best class i have ever taken” and write it under the keyword in consecutive rows going from left to right.
To encode the message, read down each column starting with the column numbered 1 and proceeding through to the column numbered 8. Reading column 1 gives us TESV, and column 2 gives us TLEE. Encoding all eight columns gives us the following message:
Two interesting observations can be made about this example. First, the choice of the keyword is once again very important, and care must be taken to make sure the keyword does not fall into the wrong hands. Second, you could make the encryption even more difficult by performing an additional substitution-based cipher on the result of the transposition cipher. In fact, why stop there? You could create a very difficult code if you repeated various patterns of substitution- and transposition-based ciphers, one after another.
3. Using the keyword JUNIOR, encode the message “I need some caffeine to stay awake in class”.
4. One of the most common forms of communication today is email. It is used for everyday conversations as well as important business decisions. If email is so important, do you or anyone you know send encrypted email? Using the email program of your choice, tell how you can encrypt your emails. Is there an option in your email program to create an encrypted message? If not, is there a third-party vendor on the Internet that will encrypt your messages? Describe it. Sending a message over an https connection is not good enough.