Cryptography - Lecture2
Cryptography - Lecture2
Spring 2006
http://www.abo.fi/~ipetre/crypto/
Ion Petre
Academy of Finland and
Department of IT, Åbo Akademi University
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Caesar can be broken even if we only have the encrypted text and
no knowledge of the plaintext
Brute-force attack is easy: there are only 25 keys possible
Try all 25 keys and check to see which key gives an intelligible message
Adapted from Handbook of Applied Cryptography (A.Menezes, P.van Oorschot, S.Vanstone), 1996
Ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZVUEPHZHMDZSHZOWSFPAPPDTSVPQUZ
WYMXUZUHSXEPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
Its strength lays in the fact that each plaintext letter has multiple
ciphertext letters
Letter frequencies are obscured (but not totally lost)
Breaking Vigenère
If we need to decide if the text was encrypted with a monoalphabetic
cipher or with Vigenère:
Start with letter frequencies
See if it “looks” monoalphabetic or not: the frequencies should be those of
letters in English texts
If not, then it is Vigenère
Example
plain: wearediscoveredsaveyourself
key: deceptivedeceptivedeceptive
cipher: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
If the key were as long as the message, then the system would be
defended against the previous attack
Vigenère proposed the autokey cipher
the keyword is followed by the message itself (see example bellow)
Decryption
Knowing the keyword can recover the first few letters
Use these in turn on the rest of the message
Note: the system still has frequency characteristics to attack and can be
rather easily defeated
Example: the key is deceptive
Weakness: plaintext and key share the same statistical distribution of
letters
plaintext: wearediscoveredsaveyourself
key: deceptivewearediscoveredsav
ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA
Example: “attack postponed until two am” with key 4312567: first read
the column marked by 1, then the one marked by 2, etc.
Key: 4 3 1 2 5 6 7
Plaintext: a t t a c k p Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
o s t p o n e
d u n t i l t
w o a m x y z
If we number the letters in the plaintext from 1 to 28, then the result of
the first encryption is the following permutation of letters from plaintext:
03 10 17 24 04 11 18 25 02 09 16 23 01 08 15 22 05 12 19 26 06 13 20 27 07 14 21 28
Note the regularity of that sequence!
Easily recognized!
17 09 05 27 24 16 12 07 10 02 22 20 03 25 15 12 04 23 19 14 11 01 26 21 18 08 06 28
Before modern ciphers, rotor machines were most common product cipher
Widely used in WW2
German Enigma, Allied Hagelin, Japanese Purple
Implemented a very complex, varying substitution cipher
Principle: the machine has a set of independently rotating cylinders through which
electrical impulses flow
Each cylinder has 26 input pins and 26 output pins with internal wiring that connects each input
pin to a unique, fixed output pin (one cylinder thus defines a monoalphabetic substitution
cipher)
The output pins of one cylinder are connected to the input pins of the next cylinder
After each keystroke, the last cylinder rotates one position and the others remain still
After a complete rotation of the last cylinder (26 keystrokes), the cylinder before it rotates one
position, etc.
3 cylinders have a period of 263=17576
4 cylinders have a period of 456 976
5 cylinders have a period of 11 881 376