图解密码技术(第二章)
- 恺撒密码 Caesar cipher,暴力破解brute-force attack(穷举搜索 exhaustive search)
- 简单替换密码 simple substitute cipher,密钥空间keyspace
2.2恺撒密码
恺撒密码是通过将明文中所使用的字母表按照一定的字数“平移”进行加密的
- 算法:将字母表中的字母平移
- 密钥:平移的字母数量
- 暴力破解:通过0-25密钥的尝试来破解密码
小测验1 破译恺撒密码
密文:PELCGBTENCUL
答:I want to use brute-force attack to cryptanalysis Caesar cipher.And I will use key by zero to twenty-five.
I use key zero to cryptanalysis,then we can get the text:pelcgbtencul
I use key one to cryptanalysis,then we can get the text:odkbfasdmbtk
I use key two to cryptanalysis,then we can get the text:ncjaezrclasj
I use key three to cryptanalysis,then we can get the text:mbizdyqbkzri
I use key four to cryptanalysis,then we can get the text:lahycxpajyqh
I use key five to cryptanalysis,then we can get the text:kzgxbwozixpg
I use key six to cryptanalysis,then we can get the text:jyfwavnyhwof
I use key seven to cryptanalysis,then we can get the text:ixevzumxgvne
I use key eight to cryptanalysis,then we can get the text:hwduytlwfumd
I use key nine to cryptanalysis,then we can get the text:gvctxskvetlc
I use key ten to cryptanalysis,then we can get the text:fubswrjudskb
I use key eleven to cryptanalysis,then we can get the text:etarvqitcrja
I use key twelve to cryptanalysis,then we can get the text:dszquphsbqiz
I use key thirteen to cryptanalysis,then we can get the text:cryptography
I use key fourteen to cryptanalysis,then we can get the text:bqxosnfqzogx
I use key fifteen to cryptanalysis,then we can get the text:pwnrmepynfw
I use key sixteen to cryptanalysis,then we can get the text:zovmqldoxmev
I use key seventeen to cryptanalysis,then we can get the text:ynulpkcnwldu
I use key eighteen to cryptanalysis,then we can get the text:xmtkojbmvkct
I use key nineteen to cryptanalysis,then we can get the text:wlsjnialujbs
I use key twenty to cryptanalysis,then we can get the text:vkrimhzktiar
I use key twenty-one to cryptanalysis,then we can get the text:ujqhlgyjshzq
I use key twenty-two to cryptanalysis,then we can get the text:tipgkfxirgyp
I use key twenty-three to cryptanalysis,then we can get the text:shofjewhqfxo
I use key twenty-four to cryptanalysis,then we can get the text:rgneidvgpewn
I use key twenty-five to cryptanalysis,then we can get the text:qfmdhcufodvm
2.3简单替换密码
简单替换密码:将明文中所使用的字母表替换为另一套字母表的密码(恺撒密码也是简单替换密码的一种)
密钥空间
- 密钥空间:一种密码能够使用的所有密钥集合
- 密钥空间越大,暴力破解就越困难。简单替换密码很难通过暴力破解来破译。
用频率分析来破解密码
- 简单替换密码使用暴力破解很难破译,但是使用频率分析的密码破译方法,就能够破译简单替换密码
- 频率分析利用了铭文中的字母的出现频率与密文中的字母的出现频率一致这一特性
- 破译过程:
- 统计这段密文中每个字母出现的频率。
- 《金甲虫》中英文字母按照出现频率排序结果:e,t,a,o,i,n,s,h,r,d,l,u,c,m,f,w,g,y,p,b,v,k,j,q,z,一般来说英语文章中出现最多的字母是e,基本没错。且一般英语文章中the出现的最多,也可以查看以e结尾的三个字母组合。
- 然后再一点点去尝试,用比较熟悉的单词。
- 破解过程的总结:
- 除了高频字母之外,低频字母也能成为线索
- 搞清开头和结尾能够成为线索,搞清单词之间的分隔也能成为线索
- 密文越长越容易破译
- 同一个字母连续出现能够成为线索(因为某个字母对应的另一个字母是确定的)
- 破译速度回越来越快
小测验2 简单替换密码的改良
答:Wrong. If Alice’s idea runs,cracking it will be easy. When you try to break the code,the possibilities for each letter went from 26 to 25.