[密码学] 破解维吉尼亚密码
文章目錄
- 窮舉密鑰搜索
- 頻率統(tǒng)計(jì)破解
- Step1:確定密鑰長(zhǎng)度
- 方法一:Kasiski測(cè)試法
- 方法二:重合指數(shù)法
- Step2:確定密鑰字相對(duì)位移
- 重合互指數(shù)
- Step3:窮搜密鑰字
- 例題
- 文件鏈接
窮舉密鑰搜索
?只適用于小的密鑰空間
頻率統(tǒng)計(jì)破解
自然語(yǔ)言英文中個(gè)字母的概率如下:
Step1:確定密鑰長(zhǎng)度
方法一:Kasiski測(cè)試法
??原理:密文中出現(xiàn)兩個(gè)相同字母組,它們所對(duì)應(yīng)的明文字母相同的可能性很大,這樣的兩個(gè)密文字母組之間的距離可能為密鑰長(zhǎng)度的整數(shù)倍
方法二:重合指數(shù)法
??原理:自然語(yǔ)言(英語(yǔ))的重合指數(shù)約為0.065,且單表代換不會(huì)改變?cè)撝?/strong>。
??定義:設(shè)x=x1x2……xn是含有n個(gè)字母的串,則在x中隨機(jī)選擇兩個(gè)元素且這兩個(gè)元素相同的概率為:
??猜測(cè)密鑰長(zhǎng)度:假設(shè)密鑰長(zhǎng)度為d,提取相同密鑰字加密的密文,測(cè)試其重合指數(shù):
???若果猜測(cè)正確,則重合指數(shù)接近0.065;
???否則,字符串表現(xiàn)得更加隨機(jī),一般在0.038~0.065之間
Step2:確定密鑰字相對(duì)位移
重合互指數(shù)
??設(shè)X=x1x2……xn,Y=y1y2……ym,分別為長(zhǎng)度為n和m的串,其重合互指數(shù)為從X與Y中分別隨機(jī)選出一個(gè)元素且兩個(gè)元素相同的概率。
??考慮不同密鑰字加密后密鑰串的重合互指數(shù):
其中s表示密文分組對(duì)應(yīng)的密鑰字母的相對(duì)位移。
經(jīng)過多位前輩的計(jì)算,當(dāng)s為正確相對(duì)位移值時(shí),該重合互指數(shù)的值應(yīng)該趨向于0.065。
Step3:窮搜密鑰字
??確定密鑰字之間關(guān)系式基礎(chǔ)上,窮舉搜索26種可能。
例題
密文:krkpewxvftksopztecxvbuhfvycgxouflihoffptrcwffwhkcevxhiuzfposdvccyctpmjtbfymllctiwxtacsmjmoncwdnawjrwtjgjsuystvbxgvcmgczbqecllttfkjlacpfttjgeegtbvkfpmhjzqaxhvvpgxoeychrcwumchhyigixhqdciawunmjerefkekcozqttznfdjlopuyqhjgrjawcpfrgxhwiljgrgiycrqkiajfgvrlrxgkkghdbqnliaovzrltgafslacjvjexrwjrdzsvruprttfkwxfgrlstznnmjerdvjdlhkwwdngjfsawgjfunhitjcaykgrptzicibtwrcpycwbkxfibrqemivotvwdnotvldmvgicshbqkztmfqlzaxrqekntqefscmbqkfxguyzjaaorgccmcovrwxbckgdgonrqhxadcclbznjfdpzgegtgqawygxkgcjiasofqiecxvbdyageztjikvrxymqlapghcbcrtfgfdnhitjcaytqiknlsnwgrtbpfrlkwvvycraqicqnhpfrwbbizliasyfpawqqljslhqgktmccumgxmqlsemcvycsxovy
密鑰:crypto
明文:
I am alive here, my beloved, for the reason to adore you.Oh!How anxious I have been for you and how sorry I am about all you must have suffered in having no news from us.May heaven grant that this letter reaches you. Do not write to me, this would compromise all of us and above all,do not return underany circumstances. It is known that it was youwhohelped us to get away from here and all would belostif you should show yourself.We are guarded day and night. Ido not care you are not here. Do not be troubled on my account. Nothing will happen to me. The national assemble willshow leniency. Farewell the most loved of men. Be quiet if you can take care of yourself.For myself I cannot write any more, but nothing in the world could stop me to adore youp to the death.
文件鏈接
https://download.csdn.net/download/Qtuanqi/16634721
總結(jié)
以上是生活随笔為你收集整理的[密码学] 破解维吉尼亚密码的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [密码学] 基础知识
- 下一篇: [密码学] Shannon保密系统的信息