Difference between revisions of "Caesar / Substitution Cipher"
(Created page with " =Caesar Cipher= The creator was Julius Caesar. It is a substitution cipher which works by shifting letters by a number. The easiest way to look at a caesar cipher is to thin...") |
(→Caesar Cipher) |
||
(13 intermediate revisions by 3 users not shown) | |||
Line 10: | Line 10: | ||
[[File:Caesar-shift-7.jpg]] | [[File:Caesar-shift-7.jpg]] | ||
+ | |||
+ | ===CraigNDave=== | ||
+ | <youtube>https://www.youtube.com/watch?v=kS9CnbhytV0&list=PLCiOXwirraUA69WUAMYyFicC5qbQ4PGc4</youtube> | ||
+ | |||
+ | https://www.youtube.com/watch?v=kS9CnbhytV0&list=PLCiOXwirraUA69WUAMYyFicC5qbQ4PGc4 | ||
+ | |||
+ | ===Computer Science Tutor=== | ||
+ | <youtube>yWgKSx0eFzY</youtube> | ||
+ | |||
+ | https://www.youtube.com/watch?v=yWgKSx0eFzY&list=PL04uZ7242_M6O_6ITD6ncf7EonVHyBeCm&index=11 | ||
==Issues with Caesar Cipher== | ==Issues with Caesar Cipher== | ||
Line 17: | Line 27: | ||
*The key is constant throughout the text, so if you crack one word you crack the entire cipher text. | *The key is constant throughout the text, so if you crack one word you crack the entire cipher text. | ||
*With sufficient cipher text you could count the frequency of every letter used. The most frequent is likely to be the character for 'e', you can then calculate the shift. | *With sufficient cipher text you could count the frequency of every letter used. The most frequent is likely to be the character for 'e', you can then calculate the shift. | ||
− | |||
=Alternative Substitution Cipher= | =Alternative Substitution Cipher= | ||
Line 41: | Line 50: | ||
[[File:400px-Letter frequency.PNG]] | [[File:400px-Letter frequency.PNG]] | ||
− | This graph shows the relative frequency of each letter after studying thousands of pages of thousands of publications. The more cipher text you have the more accurate it will be. | + | This graph shows the relative frequency of each letter after studying thousands of pages of thousands of publications. The more cipher text you have the more accurate it will be. Then you are able to decode the cypher without having any key. |
+ | |||
+ | =Revision Questions= | ||
+ | <quiz display=simple> | ||
+ | {Who was the creator of the Caesar Cipher? | ||
+ | |||
+ | | type="()"} | ||
+ | -Augustus Caesar | ||
+ | ||Wrong | ||
+ | +Julius Caesar | ||
+ | ||Correct | ||
+ | -Tiberius Caesar | ||
+ | ||Wrong | ||
+ | |||
+ | {How do you use the Caesar Cipher? | ||
+ | |||
+ | | type="()"} | ||
+ | -Substituting a set number of letters for another in a random order | ||
+ | ||Wrong | ||
+ | +The shift turns the inner wheel a specific number of spaces | ||
+ | ||Correct | ||
+ | -Use a value from the key to use a value from the plaintext | ||
+ | ||Wrong | ||
+ | |||
+ | {What is the main issue with the Caesar Cipher? | ||
+ | |||
+ | | type="()"} | ||
+ | -The relative letter frequency decryption is almost impossible | ||
+ | ||Wrong | ||
+ | +Easily cracked with brute force | ||
+ | ||Correct | ||
+ | -There is no issue | ||
+ | ||Wrong | ||
+ | |||
+ | {True/False Is Caesar Cipher a variant of Substitution Cipher? | ||
+ | |||
+ | | type="()"} | ||
+ | -False | ||
+ | ||Wrong | ||
+ | +True | ||
+ | ||Correct | ||
+ | |||
+ | {What is the issue with the substitution cipher? | ||
+ | | type="()"} | ||
+ | -The brute force attack trying all combinations | ||
+ | ||Wrong | ||
+ | +The relative letter frequency decryption | ||
+ | ||Correct | ||
+ | -There is no issue | ||
+ | ||Wrong | ||
+ | |||
+ | |||
+ | </quiz> |
Latest revision as of 11:26, 9 May 2019
Contents
Caesar Cipher
The creator was Julius Caesar. It is a substitution cipher which works by shifting letters by a number. The easiest way to look at a caesar cipher is to think of an inner and outer wheel, each wheel has the letters of the alphabet on its edge. When the letter A on both wheels are aligned the shift is 0 as in the image below:
The shift turns the inner wheel a specific number of spaces. The image below shows a shift of 7:
CraigNDave
https://www.youtube.com/watch?v=kS9CnbhytV0&list=PLCiOXwirraUA69WUAMYyFicC5qbQ4PGc4
Computer Science Tutor
https://www.youtube.com/watch?v=yWgKSx0eFzY&list=PL04uZ7242_M6O_6ITD6ncf7EonVHyBeCm&index=11
Issues with Caesar Cipher
- There are only 25 possible keys, 26 makes the same output as the input so is just like a shift of 0. Any shift above 26, eg 45 will create an identical output as one of the shifts between 1 & 25.
- This cipher only encrypts letters so the letter spacing pattern will be identical to the plain text. You can therefore select an encrypted block of text and know it has a meaning. With brute force you could discover the exact shift (ie one shift will make a recognisable word).
- The key is constant throughout the text, so if you crack one word you crack the entire cipher text.
- With sufficient cipher text you could count the frequency of every letter used. The most frequent is likely to be the character for 'e', you can then calculate the shift.
Alternative Substitution Cipher
The caesar cipher is a very basic substitution cipher. A more secure method would be to generate a random alphabet (including a space) which could then be used with the standard alphabet to map from an existing character to the new character:
This example doesn't include a space in the alphabet so will retain the word space patterns. This would be more difficult to crack but still possible, you can identify the position of each word and with enough cipher text could work out which letters have been substituted. Including a space in the alphabet and mapping it just like a normal character would mix up the word spacing.
if you encrypt the same message above:
GRAY FOX HAS ARRIVED
You get:
ILWMQUHNQOWZQWLLPVYT
Issues with Substitution Cipher
Cryptoanalysis is studying the cipher text to attempt to decrypt it without the key. This will be much harder than with a caesar cipher but with enough cipher text it will still be possible. Letter frequency analysis would work if enough cipher text was used. However you would identify the most common letter and assign that to the letter E, and then the next most common to the letter T and until you have assigned every letter according to the chart below:
This graph shows the relative frequency of each letter after studying thousands of pages of thousands of publications. The more cipher text you have the more accurate it will be. Then you are able to decode the cypher without having any key.