Lesson 2
Keywords
Keywords can be used to create a cipher as described below. This is the most simple way to do it.
Keywords can be used to create a cipher as described below. This is the most simple way to do it.
- Pick a keyword. In this case I've chosen "Leto"
- At the start of the ciphertext alphabet write your keyword.
- Then continue writing the alphabet, skipping the letters used by the keyword.
For the above example however, once all letters of the "keyword" have been skipped you will simply end up with "U-->U" "V-->V" etc. It's therefore beneficial for the keyword to contain a letter somewhere towards the end of the alphabet.
If the keyword contains 2 or more of the same letter, e.g. WINNIE, the letter is only used in the ciphertext the first time it appears, i.e. WINE (lol, it forming another word doesn't normally happen) would be used in this case. Or for "I LIKE CAKE" only ILKECA would be used.
Combining ciphers
This is one of the easiest ways to make a more complex cipher. You can either combine the 2 ciphers before you start encrypting to make one more complex cipher or encrypt the plaintext to receive "ciphertext 1" and encrypt "ciphertext 1" using another cipher to obtain "ciphertext 2". We'll look at one example of each.
1. Combine two ciphers
We will be combining the use of a keyword with the Caesar cipher. The keyword will be FOX (this produces the ciphertext at the top of the image below). After using the keyword as described above, a shift of 4 is applied (this produces the ciphertext at the bottom of the image below.
The bottom cipher can then be used to encrypt plaintext, for example MONDAY --> PRQEBX.
If the keyword contains 2 or more of the same letter, e.g. WINNIE, the letter is only used in the ciphertext the first time it appears, i.e. WINE (lol, it forming another word doesn't normally happen) would be used in this case. Or for "I LIKE CAKE" only ILKECA would be used.
Combining ciphers
This is one of the easiest ways to make a more complex cipher. You can either combine the 2 ciphers before you start encrypting to make one more complex cipher or encrypt the plaintext to receive "ciphertext 1" and encrypt "ciphertext 1" using another cipher to obtain "ciphertext 2". We'll look at one example of each.
1. Combine two ciphers
We will be combining the use of a keyword with the Caesar cipher. The keyword will be FOX (this produces the ciphertext at the top of the image below). After using the keyword as described above, a shift of 4 is applied (this produces the ciphertext at the bottom of the image below.
The bottom cipher can then be used to encrypt plaintext, for example MONDAY --> PRQEBX.
2. Perform one cipher, then another.
For this we will first use the Atbash cipher from lesson 1 and then the keyword cipher (keyword: Leto) from the start of this lesson. We will encrypt the word: UNICORN
First applying Atbash we get: FMRXLIM
Then treating FMRXLIM as the new plaintext and using the second cipher gives: BJQXIFJ
This makes decoding more difficult as you have to first use the keyword cipher (keyword: Leto) and then apply the Atbash cipher. This is harder to do when you don't know what ciphers have been applied!
For this we will first use the Atbash cipher from lesson 1 and then the keyword cipher (keyword: Leto) from the start of this lesson. We will encrypt the word: UNICORN
First applying Atbash we get: FMRXLIM
Then treating FMRXLIM as the new plaintext and using the second cipher gives: BJQXIFJ
This makes decoding more difficult as you have to first use the keyword cipher (keyword: Leto) and then apply the Atbash cipher. This is harder to do when you don't know what ciphers have been applied!
Frequency analysis
This method can be used to break simple substitution ciphers such as the Caesar cipher or random substitution ciphers. It looks at how often each letter of the alphabet typically shows up in the language - in the English language an “E” is obviously a more common letter in standard text than a “Q” for example. A graph is given below (and can be seen HERE) showing the typical amount of times all of the letters in the alphabet would appear in a standard piece of writing, 100 letters long. I know the letters are small but you get the idea (it runs from A-Z left-right). This pattern is known as the “frequency distribution” of the letters in the English language.
This method can be used to break simple substitution ciphers such as the Caesar cipher or random substitution ciphers. It looks at how often each letter of the alphabet typically shows up in the language - in the English language an “E” is obviously a more common letter in standard text than a “Q” for example. A graph is given below (and can be seen HERE) showing the typical amount of times all of the letters in the alphabet would appear in a standard piece of writing, 100 letters long. I know the letters are small but you get the idea (it runs from A-Z left-right). This pattern is known as the “frequency distribution” of the letters in the English language.
Frequency analysis is based on statistical analysis as opposed to concrete fact. It’s a useful tool for breaking simple substitution ciphers such as the Caesar Cipher covered above. As the Caesar Cipher simply shifts the alphabet along it means that the shape of the frequency distribution of the letters in the ciphertext is ~identical to the shape of the frequency distribution of the letters in the plaintext - just shifted along by however much the cipher shifts things by. As such, you can crack the code by looking and identifying the typical frequency distribution shape shown above and matching up the cipher text distribution with the expected plain text distribution. If the ciphertext is short however, its frequency distribution is unlikely to look like the one above.
Vigenere cipher
This is a polyalphabetic cipher (a plaintext A will not always encode to, for example, a ciphertext C it may also encode to an X). It uses a number of Caesar ciphers and a password known as a ‘keyword’.
Example
This is a polyalphabetic cipher (a plaintext A will not always encode to, for example, a ciphertext C it may also encode to an X). It uses a number of Caesar ciphers and a password known as a ‘keyword’.
Example
- Choose your plain text: FILCHSOFFICEATEIGHT (19 letters)
- Choose your keyword: POTTER (6 letters)
- Repeat the keyword to match the length of the plaintext: POTTERPOTTERPOTTERP (19 letters)
- Match up the letters of the plaintext with its corresponding letter in the repeated keyword pattern. I.e. F goes with P, I with O, L with T etc until you reach the end of the plaintext.
5. Use the Vigenere cipher to encrypt the message (see the diagram below). For example, the first F matched with P so you would read across the F row until you met with where the P column came down and would reach the letter U, which would be the start of your cipher.
6. Voila, you have your encrypted text. For the plain text above, the encryption begins: UWE
Decoding Vigenere
So you know the Vigenere cipher was used and you have the keyword...how do you decode it? For simplicity let's take the UWE from above with the keyword "potter."
POT
UWE
So you know the Vigenere cipher was used and you have the keyword...how do you decode it? For simplicity let's take the UWE from above with the keyword "potter."
- Start by writing the keyword out (over and over) above the ciphertext. I'm only using 3 letters of the ciphertext as it's just to give you an idea.
POT
UWE
- Now for each pair of letters (PU,OW,TE) you need to do the following. Find the column (blue letters) of the keyword letter. Read down it until you find the ciphertext letter. Find out which row this corresponds with (red letters).
- For example, reading down the P column until we find U....the corresponding row is F.
Voila! Continue doing this with all the letters until you're done :)
Please note, if the keyword has the letter A in it, decoding the ciphertext letters paired with the A is easy, A=A, B=B etc!
Please note, if the keyword has the letter A in it, decoding the ciphertext letters paired with the A is easy, A=A, B=B etc!
---------------------------------
You have survived another lesson :D Onto the ASSIGNMENT.