Module :MA3036NI Cryptography and Number Theory Lecture Week 3 Symmetric Encryption-2.

Post on 02-Jan-2016

221 views 3 download

transcript

Module :MA3036NICryptography and Number Theory

Lecture Week 3Symmetric Encryption-2

2

Poly alphabetic Ciphers

• Another approach to improving security is to use multiple cipher alphabets

• Called polyalphabetic substitution ciphers • Makes cryptanalysis harder with more alphabets to

guess and flatter frequency distribution • Use a key to select which alphabet is used for each

letter of the message • Use each alphabet in turn • Repeat from start after end of key is reached

Poly alphabetic CiphersThe polyalphabetic substitution cipher is a simpleextension of the monoalphabetic one.The difference is that the message is broken into blocks of equal length, say B, and then each position in the block (1… B) is encrypted (or decrypted) using a different simplesubstitution cipher key. The block size (B) is oftenreferred to as the period of the cipher.

Poly alphabetic Ciphers• Example of the polyalphabetic substitution cipher key and

encryption process.(Using block size 3 )Plaintext: ABCDEFGHIJKLMNOPQRSTUVWXYZCipherkey: NDWIEURYTLAKSJQHFGMZPXOBCV

(Position 1) LPMKONJIBHUVGYCFTXDRZSEAWQ

(Position 2) GFTYHBVCDRUJNXSEIKMZAOLWQP

(Position 3)

• Position: 123 123 123• Plaintext: HOW ARE YOU• Cipher text: RYOVLKIQWJR (How to decrypt?)

5

Vigenère Cipher• Simplest polyalphabetic substitution cipher is the

Vigenère Cipher • Effectively multiple Caesar ciphers • Key is multiple letters long K = k1 k2 ... kd • ith letter specifies ith alphabet to use • Use each alphabet in turn • Repeat from start after d letters in message• Decryption simply works in reverse

6

Example• Write the plaintext out • Write the keyword repeated above it• Uses each key letter as a Caesar cipher key • Encrypt the corresponding plaintext letter• E.g. using keyword deceptive

key: deceptivedeceptivedeceptiveplaintext: wearediscoveredsaveyourselfciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ( How to decrypt?)

7

Vigenère Table

8

Security of Vigenère Ciphers• There are multiple cipher text letters for each

plaintext letter• Hence letter frequencies are obscured, but not

totally lost

Q. Encipher “TO BE OR NOT TO BE THAT IS THE QUESTION", using a Vigenère cipher with keyword“SUBSTITUTION”.

9

Kasiski Method• Method developed by Babbage / Kasiski to find the

length of key word in Vigenère chpher• Repetitions in cipher text give clues to period • So find same plaintext an exact period apart • Which results in the same cipher text • Of course, could also be random fluke• E.g. repeated “VTW” in previous example suggests that

the size of keyword is 3 or 9 • Then attack each mono alphabetic cipher individually

using same techniques as before

10

One-Time Pad• If a truly random key as long as the message is used,

the cipher will be secure • Called a One-Time pad• It is unbreakable since ciphertext bears no statistical

relationship to the plaintext• Since for any plaintext & any ciphertext there exists a

key mapping one to other• The key can only be used once though• There is a problem of safe distribution of key

One-Time Pad• Encryption is a additional modulo 26 of plaintext character• key length must be equal to the message length !!!• For example:

– Message: ONETIMEPAD– Pad Sequence: TBFRGFARFM– Cipher text: HO………

Because

O+T mod 26 = H 14+19 mod 26 = 7

N+B mod 26 = O 13+1 mod 26 = 14

E+F mod 26 = ……… etc.

DecryptionP+K mod 26 = C P = C-K mod 26H-T mod 26 =7-19 mod 26 = -12 mod 26 = 14 = O

11

12

Transposition Ciphers• Now consider classical transposition or

permutation ciphers • These hide the message by rearranging the

letter order without altering the actual letters used

• They can be recognised since have the same frequency distribution as the original text

13

Rail Fence cipher• Write message letters out diagonally over a

number of rows • Then read off cipher row by row• E.g. write message "meet me after the toga

party” out as:m e m a t r h t g p r ye t e f e t e o a a t

• Giving cipher textMEMATRHTGPRYETEFETEOAAT

14

Row Transposition Ciphers

• This is a more complex scheme• Write letters of message out in rows over a specified

number of columns• Then reorder the columns according to some key

before reading off the rowsKey: 4 3 1 2 5 6 7Plaintext: a t t a c k p o s t p o n e d u n t i l t w o a m x y zCiphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ

15

Product Ciphers

• Ciphers using substitutions or transpositions are not secure because of language characteristics

• Hence consider using several ciphers in succession to make it harder, but: – two substitutions make a more complex substitution – two transpositions make more complex transposition – but a substitution followed by a transposition makes a

new much harder cipher

• This is bridge from classical to modern ciphers

16

Rotor Machines

• Before modern ciphers, rotor machines were most common product cipher

• They were widely used in WW2– E.g. German Enigma, Japanese Purple

• They implemented a very complex, varying substitution cipher

• Used a series of cylinders, each giving one substitution, which rotated and changed after each letter was encrypted

• With 3 cylinders have 263=17576 alphabets

The Rotor Machine

17

Enigma Rotor Machine

Steganography• An alternative to encryption• Hides existence of message– using only a subset of letters/words in a longer message

marked in some way– using invisible ink– hiding in graphic image or sound file

• Drawbacks– high overhead to hide relatively few info bits

20

Example hide your plaintext in a graphic image •Each pixel has 3 bytes specifying the RGB color

•The least significant bits of pixels can be changed without greatly affecting the image quality

•So can hide messages in these LSBs

Steganography

Summary

• Polyalphabetic ciphers

• Transposition ciphers

• Product ciphers

• Rotor machines

• Steganography