第三讲 古典替换密码 classical substitution ciphers

17
第第第 第第第第第第 Classical substitution ciphers 第第第第第第第第第第第第第第第 第第第 第第第第第 [email protected]

Upload: drea

Post on 12-Jan-2016

232 views

Category:

Documents


0 download

DESCRIPTION

第三讲 古典替换密码 Classical substitution ciphers. 上海交通大学计算机科学与工程系 信息安全工程学院 郑东 [email protected]. 1. 古典加密技术. 两个基本组成部分:替换与变换 (substitution and transposition). 2. Caesar Cipher. Caesar 密码的数学表示 设: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 第三讲 古典替换密码 Classical substitution ciphers

第三讲 古典替换密码 Classical substitution ciphers

上海交通大学计算机科学与工程系

信息安全工程学院

郑东

[email protected]

Page 2: 第三讲 古典替换密码 Classical substitution ciphers

1. 古典加密技术

两个基本组成部分:替换与变换 (substitution and transposition)

Page 3: 第三讲 古典替换密码 Classical substitution ciphers

2. Caesar Cipher

Caesar 密码的数学表示 设:

A the value 0, B 1, C 2, ... Y 24, Z 25; 加密算法:

Ek: i -> i + k (mod 26)

解密算法: Dk: i -> i - k (mod 26)

Page 4: 第三讲 古典替换密码 Classical substitution ciphers

3. 密码分析( Cryptanalysis of Caesar ciphers )

只有 26 种可能( only have 26 possible ciphers ) A maps to A,B,..Z 可以简单的实验每个密钥(穷密钥搜索) 给定一些密文,实验每个密钥。 LIZHZLVKWRUHSODFHOHWWHUV Original ciphertext KHYG

YKUJVQTGRNCEGNGVVGTU try shift of 1 JGXFXJTIUPSFQMBDFMFUUFST try shift of 2 IFWEWISHTOREPLACELETTERS try shift of 3 *** plaintext HEVDVHRGSNQDOKZBDKDSSDQR try shift of 4 GDUCUGQFRMPCNJYACJCRRCPQ try shift of 5 ..... MJAIAMWLXSVITPEGIPIXXIVW try shift of 25

eg. break ciphertext "GCUA VQ DTGCM"

Page 5: 第三讲 古典替换密码 Classical substitution ciphers

4. 语言冗余度与密码分析

人类语言是有冗余度的 字母使用的频率是不相同的 在英语中, e 的使用率是最高的 其次, T,R,N,I,O,A,S 其它字母使用的较低

Page 6: 第三讲 古典替换密码 Classical substitution ciphers

5. 英语字母使用频率

Page 7: 第三讲 古典替换密码 Classical substitution ciphers

6 。字母频率在密码分析中的应用

计算密文中字母出现的频率 与已知字母分布比较 单码替换不改变相对字母出现的频率 阿拉伯科学家提出此方法

Page 8: 第三讲 古典替换密码 Classical substitution ciphers

7. 英语字母中常见的组合

Page 9: 第三讲 古典替换密码 Classical substitution ciphers

8 。打乱的密码代换 不仅仅是简单的移位变换 每个字母可以避免随意变换到其它不重复的字母 每个字母变换到不同的字母 密钥长度是 26 个字母 eg.

Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN

Plaintext: IFWEWISHTOREPLACELETTERS Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA

Page 10: 第三讲 古典替换密码 Classical substitution ciphers

9 。打乱的密码代换的安全性 密钥总数: 26 ! 如此多的密钥,可以认为安全吗? !!!NO!!! 仍然有语言统计规律 需要其它方法隐藏这种规律性

Page 11: 第三讲 古典替换密码 Classical substitution ciphers

10 。一般单码替换密码 简单的方法给出密钥 写出密钥(删除重复字母) write key (with repeated letters deleted) 在其下面依次写出剩余字母(以横、纵行) 按列读取字母得到密文。 then read off by columns to get ciphertext

equivalents

Page 12: 第三讲 古典替换密码 Classical substitution ciphers

11 。一般单码替换密码 举例 给定密钥字 "STARWARS" 去掉重复字母得到 "STARW" 填写剩余字母: STARW BCDEF GHIJK LMNOP QUVXY Z 按列读取字母得到密文 Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher: SBGLQZTCHMUADINVREJOXWFKPY 可以用这个密钥加密、解密 例如 Plaintext: I KNOW ONLY THAT I KNOW NOTHING Ciphertext: H UINF NIAP OCSO H UINF INOCHIT

Page 13: 第三讲 古典替换密码 Classical substitution ciphers

12 。一般单码替换密码 的密码分析

根据频率统计进行分析 确定每个字母被映射到什么字母 单个字母出现的可能是 A 或 I ( since know single word

s are 'A' or 'I' ) 一般来说个字母出现的可能是 THE 或 AND 还可以用其他通常出现的双字母或三字母组合 (otherwi

se just use common double and triple letters ) 还可以应用其它很少应用的字母 also use knowledge of r

arely used letters

Page 14: 第三讲 古典替换密码 Classical substitution ciphers

13. 信息论与熵

C.E. Shannon (香农) ,

1948, A mathematical theory of communication.

确立了现代信息论。1949, Communication theory of secrecy systems.

定义了密码系统的精确数学模型。

Page 15: 第三讲 古典替换密码 Classical substitution ciphers

13.2 熵 entropy

熵( Entropy ,定义为事件集 X 中事件出现的信息的统计平均值

它表示 X中出现一个事件平均给出的信息量,或事件的平均不确定性

0 )(

1log)()(

i iai

xpxpXH

Page 16: 第三讲 古典替换密码 Classical substitution ciphers

Exercises

encrypt and then decrypt by hand, the text below using a general monoalphabetic cipher with a key of "NIFTY":

the cat only grinned when it saw alice it looked good natured she thought still it had very long claws and a great many teeth so she felt that it ought to be treated with respect

Page 17: 第三讲 古典替换密码 Classical substitution ciphers

OK!