[密码学] 破解维吉尼亚密码
文章目錄
- 窮舉密鑰搜索
- 頻率統計破解
- Step1:確定密鑰長度
- 方法一:Kasiski測試法
- 方法二:重合指數法
- Step2:確定密鑰字相對位移
- 重合互指數
- Step3:窮搜密鑰字
- 例題
- 文件鏈接
窮舉密鑰搜索
?只適用于小的密鑰空間
頻率統計破解
自然語言英文中個字母的概率如下:
Step1:確定密鑰長度
方法一:Kasiski測試法
??原理:密文中出現兩個相同字母組,它們所對應的明文字母相同的可能性很大,這樣的兩個密文字母組之間的距離可能為密鑰長度的整數倍
方法二:重合指數法
??原理:自然語言(英語)的重合指數約為0.065,且單表代換不會改變該值。
??定義:設x=x1x2……xn是含有n個字母的串,則在x中隨機選擇兩個元素且這兩個元素相同的概率為:
??猜測密鑰長度:假設密鑰長度為d,提取相同密鑰字加密的密文,測試其重合指數:
???若果猜測正確,則重合指數接近0.065;
???否則,字符串表現得更加隨機,一般在0.038~0.065之間
Step2:確定密鑰字相對位移
重合互指數
??設X=x1x2……xn,Y=y1y2……ym,分別為長度為n和m的串,其重合互指數為從X與Y中分別隨機選出一個元素且兩個元素相同的概率。
??考慮不同密鑰字加密后密鑰串的重合互指數:
其中s表示密文分組對應的密鑰字母的相對位移。
經過多位前輩的計算,當s為正確相對位移值時,該重合互指數的值應該趨向于0.065。
Step3:窮搜密鑰字
??確定密鑰字之間關系式基礎上,窮舉搜索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
總結
以上是生活随笔為你收集整理的[密码学] 破解维吉尼亚密码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [密码学] 基础知识
- 下一篇: [密码学] DES(一)