第四章 傳統密碼學. outline substitution cipher transportation cipher

51
第第第 第第第第第

Upload: clarence-barton

Post on 02-Jan-2016

260 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

第四章

傳統密碼學

Page 2: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Outline

Substitution Cipher Transportation Cipher

Page 3: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Caesar Cipher

Each plaintext character is replaced by the character three to the right modulo 26

plaintext pi is enciphered as ciphertext letter ci by the

rule ci = E(pi)=pi+3

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

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 D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

Page 4: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Caesar Cipher

Advantages of Caesar Cipher Simple Easy to memorize

Disadvantages of Caesar Cipher interceptor can use a little piece to predict the

entire pattern of the encryption

Page 5: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Cryptanalysis of the Caesar Cipher

Example:T REA TY I MPOSSI BLE WUHDWB LP SRVVLEOH

線索 ss-> vv T, I, and E -> W, L, and H

空白 -> 空白 提示如何分辨一個字 可以改將空白移去 特殊短字: am, is, to, be, he, we, and, are, you, she, ... 試著去找出對應的小字 three-letter word “ too”, “see”, “add”, “odd”, “off” 亦是一特

殊類型

Page 6: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example

wklv phvvdjh lv qrw wrr kdug wr euhdn t ot too to -ot 可能為 “ cot”, dot”, “got”, “hot”, “not” lv 為 wklv 的字尾, “ so”, “is”, “in” ->”Is” -> k -

> h 常用技巧:

最常出現之開始字元 最常出現之結束字元 前後字元相同:” sleeps”

Page 7: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Monoalphabetic Cipher alphabetic is scrambled (擾亂) each plaintext letter maps to a unique ciphertext letter. A permutation is a recording of the elements of a series. A permutation is a function.

Example of permutation: π1=1,3,5,7,9,10,8,6,4,2 π2=10,9,8,7,6,5,4,3,2,1 π1(3)=5, π2(7)=4

If a1, a2, ..., ak are the letters of the plaintext alphabet, and π is a permutation of the numbers 1,2,...,k, in a monoalphabetic substitution each ci is aπ(pi)

Page 8: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example of permutation

π(a) might be the function π(a) =25-a Thus , a->z, b-> y, z->a 缺點: E(F)=u, and E(U)=F double correspo

ndence.

Page 9: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

monoalphabetic 的變形 keyword mixed alphabet: 利用 KEY 來控制 enciph

ering 若 KEY 為 key 則對應的方式為:

缺點 KEY 一般都很短,移位不多。

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

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 K E Y A B C D F G H I J L M N O P Q R S T U V W X Z

Page 10: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example of monoalphabetic

key 中的字元若有重複: spectacular

缺點:末幾位字元幾乎對應到自己 幸好這些字元一般也比較少用。

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

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 S P E C T A U L R B D F G H I J K M N O Q V W X Y Z

Page 11: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Monoalphabetic 再變形 A less regular rearrangement of the letters is desi

rable. One possible is to count by 3s (or 5s or 7s or 9s)

and rearrange the letters in that order.

Example: π(i)=(3*i) mod 26, π(k)=(3*10) mod 26 = 30-26=4

e π(e)=(3*4) mod 26 = 12=m

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

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 A D G J M P S V Y B E H K N Q T W Z C F I L O R U X

Page 12: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Ciphers based on multiplications f(a)=ak mod n Example:

If k =9 then Encoding(RENAISSANCE) will generate “XKNAUGGANSK”

Note: If k and n are not relatively prime, several plaintext letters will encipher to the same ciphertext letters.

Example, if n =26 and k =13, f(A)=f(C)=f(R)=...=f(Y)=A f(B)=f(D)=f(F)=...=f(Z)=N

Page 13: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Affine transformation

Addition (shifting) and multiplication cam be combined to give an new method.

f(a)=(ak1 + k0 )mod n, where k and n are relatively prime.

Polynomial transformation of degree t: f(a)=(atkt + at-1kt-1 +...+ ak1 + k0 ) mod n Caesar ciphers are polynomial transformations of

degree 0, while affine transformations are of degree 1.

Page 14: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Churchyard cipher use nonstandard ciphertext alphabets The key to the cipher is given by the “tic-tac-toe” diagrams

Other encoding method: music symbol

Page 15: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Cryptanalysis of Monoalphabetic Ciphers

Use the technique to break the Caesar cipher to break monoalphabetic cipher

Guess-> substantiate -> correct or contradiction

Frequency Distributions: in English, some letters are used more frequently than others.

E, T, and A occur far more frequency than J, Q, and Z for

Page 16: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example

Page 17: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Solution

Page 18: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Letter Frequency Distribution

Page 19: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Frequency of example

Page 20: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Frequencies of Sample Cipher against Normal Text

Page 21: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Polyalphabetic Substitution

monoalphabetic cipher 的缺點: Their frequency distribution reflects the distribution of th

e underlying alphabet A cipher that is more secure would display a rathe

r flat distribution, which gives no information to a cryptanalyst.

New method: Flatten the distribution, to combine distributions that are

high with ones that are low. E.g. E1(T) =a and E2(T) =b which E1(X) =a and E2(X)=b

Page 22: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Polyalphabetic Substitution

We can combine two distributions by using two separate encryption alphabets, the first for all the characters in odd positions of the plaintext message, the second for all the characters in the even positions.

Page 23: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example0 1 2 3 4 5 6 7 8 9 1

0 11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

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 a d g j m p s v y b e h k n q t w z c f i l o r u x

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

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 n s x c h m r w b g l q v a f k p u z e j o t y d i

Example: TREAT YIMPO SSIBL E fumnf dyvtf czysh h

Page 24: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Polyalphabetic Substitution

Page 25: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Two-alphabet encryption letter frequencies

E1(a) =a and E2(a)=25-a

Page 26: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Vigenere Tableaux

polyalphabetic 之缺點 j, q 很少用,但 j -> q

改進法: Select any permutation as π1, and then carefully

choose π1; if π1 maps a high frequency letter such as E to x, the π2 should map a low frequency to x.

Extended the number of permutations.

Page 27: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Vigenere tableau

Page 28: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Vigenere Tableaux

choose keyword: e.g. juliet Assume Plaintext:

Each plaintext letter pi is the converted to the ciphertext letter in row pi, column ki of the tableau.

j u l i e t j u l i e t j u l i e t j U

B U T S O F T W H A T L I G H T T H R O

k o e a s y c q s i

Page 29: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Transposition (permutation) A transportation is an encryption in which the letters of the

message are rearrange. Columnar transportation

The columnar transportation is a rearrangement of the characters of the plaintext into columns.

Example:

c1 c2 c3 c4 c5

c6 c7 c8 c9 c10

c11 c12 c13 c14 c15

The resulting ciphertext is formed by transversing the columns.

c1c6c11c2c7c12c3c8c13c4c9c14c5c10c15

Page 30: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example of Columnar transportation

Page 31: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Double Transportation Algorithm

The double transportation cipher involves two column transpositions, with different numbers of columns, applied one after the other.

The first transposition displaces adjacent letters, and the second breaks up the adjacency of short series of letters that happened to appear in adjacency columns of the first transposition.

Page 32: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example of double transposition

Page 33: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Padding letter

A better way of padding is to use letters that would occur frequently anyway, such as a, e, i, n, o, s, so that it would not be possible to identify the padding characters easily.

Page 34: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Fractionated Morse

blocked cipher Morse code is a means of representing

letters as sequences of dots and dashes used with telegraphs, flashing lights, semaphore flags.

Table of Morse codes Encoding: add break or pause between

separate letters.

Page 35: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example

Page 36: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Morse code

Morse code is really three-symbol coding scheme using the symbols “dash”, “dot” and “separator”.

33=27 =26 + 1 All but one of the possible groups of dashes,

dots, and separators can be associated with the English letter.

Page 37: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Encoding

Step 1: The English plaintext is converted to Morse code, using a separator between letters and an extra separator to represent a space between words.

Step 2: The Morse code message is divided into blocks of three symbols.

Step 3: Finally, each block is encoded as the letter corresponding to that three-symbol pattern.

Page 38: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example

Page 39: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Example

Page 40: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Cryptanalysis of Transpositions

Page 41: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Most Common Digrams and Trigrams

Page 42: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Frequencies of Digrams in English

Page 43: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Frequencies of Digrams in English

Page 44: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher
Page 45: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher
Page 46: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Cryptanalysis of Polyalphabetic Substitutions

Page 47: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Cryptanalysis of Polyalphabetic Substitutions

Page 48: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Cryptanalysis of Polyalphabetic Substitutions

Page 49: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Cryptanalysis of Polyalphabetic Substitutions

Page 50: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Cryptanalysis of affine transformation

Page 51: 第四章 傳統密碼學. Outline  Substitution Cipher  Transportation Cipher

Cryptanalysis of affine transformation