|
|
| Preliminaries |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Definitions |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| A simple scheme |
We need a way of transforming plain text into cipher text. Here's one:
What's going on: Another view:
One way to think about this is that we start with the inner and outer circle of letters aligned, which stands for realizing "a" as "a", "b" as "b", and so on.
Because we shift 3 letters, a => d, b => e, and so on, this is called a "shift 3" cipher. We can of course shift amounts other than 3. This is the shift-8 cipher:
There are 25 possible shift ciphers. Shift-26 is the same as no shift at all,"a=>a, b=>b" and so on:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Caesar's Cipher |
Julius Caesar is supposed to have used this cipher for military dispatches he wished to keep secret. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Other Historical Precedents |
According to some, as you probably know, Shakespeare's plays weren't written by Shakespeare; he is supposed to to have displayed much too wide a knowledge of history, statecraft, scripture, and mythology for an uneducated nobody from Stratford. Among the many identities he has been claimed to have, one of the most popular is Francis Bacon. Here's one "argument" for that view:
B O T E S V A I N E C P V F T Y B K O F 1 [Shift-1] D Q Y G V A C L P G 2 [Shift-2] E R A H Y B D M Q H 3 [Shift-3] F S B I A C E N R I 4 [Shift-4]The plaintext, then, is "F S B I A C E N R I". It appears on the "FORTH" (+4) line in which "A" = "e". Bacon's 21 letter alphabet, ending in "T V Y," remains the same. "FS" is Bacon's own signature abbreviation of his first name while "BIACEN" is yet another phonetic spelling of his surname.
Ciphertext: A B C D E F G H I K L M N O P Q R S T V Y Plaintext: E F G H I K L M N O P Q R S T V Y A B C DHere I = J and V = V, U and W. There is no X or Z.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Encryption Tool Demo |
You will find a downloadable version of the Encryption Tool here. Read the installation directions carefully. Basically the download file is a self-extracting executable. Put the file somewhere on your home machine and then click on it. The program will ask you where you want to install it [give it a permanent home]. Pick anywhere --- just make sure you remember where you pick so you can find it later. A reasonable choice is your DeskTop. Once you find the installed program, just click on it and the following window appears (will look slightly different in Windows):
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Shift Cipher Keys |
Repeating our definitions:
By these definitions the encryption key for a shift cipher can just be one of the 25 possible shift values. So our first cipher was a shift-3 cipher, so 3 is the encryption key. What is the decryption key? Well once you know how much you shifted you know how much to unshift to decrypt it, so 3 could be the decryption key as well. But there is another way of looking at it that will be mathematically more useful. Recall that shifting 26 just gives us back the same letters. So if we shift 3, followed by shifting 23, that should also give us back the same message. [shift-3] + [shift-23] = [shift-26] = [shift-0]Which leads to the following:
And then to the following:
Notice that this way of looking at it is nice if you write computer programs. I need one program called encrypt, which takes 2 pieces of input, a plain text and a shift value, and gives me back a cipher text.
>>> encrypt('the porcupine is under the sheets',3)
'wkh srufxslqh lv xqghu wkh vkhhwv'
But give the same program the cipher text and the decryption key and it gives you the plain text:
>>> encrypt('the porcupine is under the sheets',3)
'wkh srufxslqh lv xqghu wkh vkhhwv'
>>> encrypt('wkh srufxslqh lv xqghu wkh vkhhwv',23)
'the porcupine is under the sheets'
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Breaking Shift Ciphers |
This isnt the part of the course where we talk seriously about breaking ciphers. But the shift ciphers are so easy to break it's worth mentioning that fact here. Shift ciphers can be broken by what we call a brute force attack. Here's the attack:
Here's an example: Cipher text: haahjr ha khdu --------------------------- Shift: 0: haahjr ha khdu Shift: 1: ibbiks ib liev Shift: 2: jccjlt jc mjfw Shift: 3: kddkmu kd nkgx Shift: 4: leelnv le olhy Shift: 5: mffmow mf pmiz Shift: 6: nggnpx ng qnja Shift: 7: ohhoqy oh rokb Shift: 8: piiprz pi splc Shift: 9: qjjqsa qj tqmd Shift: 10: rkkrtb rk urne Shift: 11: sllsuc sl vsof Shift: 12: tmmtvd tm wtpg Shift: 13: unnuwe un xuqh Shift: 14: voovxf vo yvri Shift: 15: wppwyg wp zwsj Shift: 16: xqqxzh xq axtk Shift: 17: yrryai yr byul Shift: 18: zsszbj zs czvm Shift: 19: attack at dawn Shift: 20: buubdl bu ebxo Shift: 21: cvvcem cv fcyp Shift: 22: dwwdfn dw gdzq Shift: 23: exxego ex hear Shift: 24: fyyfhp fy ifbs Shift: 25: gzzgiq gz jgctSo the decryption key is 19, the encryption key is therefore 7. This didn't take a lot of cleverness. But there's an important point here. Most serious encryption methods can be cracked by a brute force attack. The serious question will always be not whether such an attack is possible, but whether it's practical. (for example, will it take longer than the age of the universe to compute?) This brute force attack was eminently practical. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Encoding |
Most serious encryption methods involve applying an encoding step to the plain text. In the computer world an encoding of a text is just a cipher everyone knows about. Usually the encoding turns the text into numbers; computers are good with numbers. For talking about shift ciphers, the following encoding is pretty useful:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Encrypting by Arithmetic |
Basically once we use the above encoding, encryption can just be addition. For a shift-3 cipher, we add 3:
But wait, there's something funny going on off to the right. For the encoding of x, y and z. 23 + 3 = 0 "x" "a" 24 + 3 = 1 "y" "b" 25 + 3 = 2 "z" "c"But this isn't right, is it? What we want here is clockface addition. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Modular Addition |
Basically, this rule will work for any of our 25 possible keys, as long as we follow the clockface rule of starting from 0 again once we get higher than 25:
This kind of addition merits a mathematical name. It is called modular addition. We call the number of numbers on the clockface the "modulus". Normal clockface addition is addition "mod 12". Cipher shifting addition is addition "mod 26". We write the above addition as follows: 19 + 11 = 4 mod 26 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||