经典单码加密法KeywordCipher1.selectakeyword-ifanylettersarerepeateddropthesecondandallotheroccurrencesfromthekeyword1.选择一个关键词,如果这个关键词中有重复的字母,则去除第一次出现之外的所有相同字母。2.writethekeywordbelowthealphabet,fillintherestofthespacewiththeremaininglettersinthealphabetintheirstandardorder2.将关键词写在字母表的下方,并用字母表中除了关键词之外的其他字母按标准的顺序填写余下的空间。ExampleThekeywordisMAGICNETABCDEFGHIJKLMNOPQRSTUVWXYZplaintextciphertextCNETBFDJHLKPORQUSWVXZYIMAG这样的话,明文字母A就由密文字母M来替换,B则由A来替换,...明文:HELPIAMLOST密文:TCHOBMJHLRSExerciseThekeywordisCOUNTABCDEFGHIJKLMNOPQRSTUVWXYZplaintextciphertextTABDEGFIHKJMLQPSRWVXZYNCOUStartingPositionThekeyworddoesnothavetostartatthebeginningoftheplaintextalphabet(关键词不从第一字母开始)itcouldstartatanyletterforexample,“count”couldstartat“k”ciphertextTABDEGFIHKJLMQPSRWVXZYNCOUABCDEFGHIJKLMNOPQRSTUVWXYZplaintextExampleIfthekeywordis“visit”(note,thesecond“i”invisitisdroppedbelow)startingat“a”andtheplaintextis“next”,theapplicationis:ABCDEFGHIJKLMNOPQRSTUVWXYZplaintextciphertextLMNOPRQWUYXZVSIATCBDFEKGHJNEXTKAXQKeywordinCAP运行CAP软件,输入一些明文,然后从Cipher菜单选取Keyword菜单项,将弹出一个KeywordCipher窗口。关键词加密法的分析法关键词加密法当然比简单移位加密法功能更强,因为要尝试所有的关键词及其位置,显然比所有25种移位加密密钥要困难得多。这种攻击法的原理就是计算机用字典中的每个词进行尝试,直至找到一个能破解该加密法的为止。用穷举查找攻击法(即尝试所有可能的关键词)在今天也是可行的,但不是可取的。BreakingaKeywordThekeywordcipherisnotsecure,infactitiseasytobreakOnereasonwhyitisusefultostudysuchacipheristhatinordertobreakthiscipheryoumustusesomeofthemostfundamentaltoolsofcryptanalysis(破译关键词密码需要一些密码分析基本工具)ChallengeConsiderasimplemonoalphabetickeywordsubstitutionciphersuchasthefollowing:GJXXNGGOTZNUCOTWMOHYJTKTAMTXOBYNFGOGINUGJFNZVQHYNGNEAJFHYOTWGOTHYNAFZNFTUINZBNFGNLNFUTXNXUFNEJCINHYAZGAEUTUCQGOGOTHJOHOATCJXKHYNUVOCOHQUHCNUGHHAFNUZHYNCUTWJUWNAEHYNAFOWOTUCHNPHOGLNFQZNGOFUVCNZJHTAHNGGNTHOUCGJXYOGHYNABNTOTWGNTHNTXNAEBUFKNFYOHHGIUTJUCEAFHYNGACJHOATAEIOCOHUFQXOBYNFGBasicCryptanalysisThemostbasicobservationofcryptanalysisisthateveryletterofalanguagehasapersonalityofitsownifeveryplaintexttischangedtoaciphertextm,thenintheciphertext,massumesthepersonalityofttothetrainedobserver,thepersonalityofalettergivesawayitsidentity对训练有素的观察者来说,字母的特性揭示了其真实面目。Someofthesepersonalitycharacteristicsare:frequencyofoccurrencecontactwithotherletterspositionwithinwords字母的特性主要有:出现的频率、与其他字母的联系、在单词中的位置。LetterFrequencyWhatisthemostfrequentletterinEnglish?Actuallythefrequencydependsonthetypeoftext.Awidelyusedfrequencytableof400lettersofstandardEnglish(英文字母的频率)Letter:ABCDEFGHIJKLMNOPQCount:326121642862426221412283281Letter:RSTUVWXYZCount:2624361246281InOrder:ETAONIRSHDLUCMPFYWGBVJKQXZLetterFrequencyThefrequencycountforthechallengetextis:ABCDEFGHIJKLMNOPQRSTUVWXYZ1741307172326512322362515002320369138Wecouldcomparethiswiththeexpectedfrequency:Standard:ETAONIRSHDLUCMPFYWGBVJKQXZCipher:NHOGTUAFCYJXZEWIQBKVLMPDRS(密文)Result:OLUUEOOANCEIHANPJATD...However,whilerelativefrequenciesmayshiftslightly,(imaybemorefrequentthana),theydonotstrayfarfromtheirareainthefrequencytableLetterFrequency当然,这只是个概数,不会与每篇文章的字母出现频率完全一样,通常越短的信息的字母频率与上面的相比就越不相符,越短的信息也就越难破解了。如:John,ajazzist,willgotoJapaninJunetojoinajazzparty.其中,J的百分比是12.8,出现6次,而E的百分比是0,对其进行频率分析就毫无意义。又如:UOCTXH.若明码表ABCDEFGHIJKLMNOPQRSTUVWXYZ密码表QWERTYUIOPASDFGHJKLZXCVBNM则它被翻译为GIVEUP.但若明码表ABCDEFGHIJKLMNOPQRSTUVWXYZ密码表QWUETRYIXPASCHOMDFGJKLZVBN则它被翻译为COMEIN.究竟哪个是真的,不得而知。但当它放进一篇文章里,就可从前后推知它应怎样翻译了。FrequencyGroupsHighFrequencyGroupETAONIRSHMediumFrequencyGroupDLUCMLowFrequencyGroupPFYWGBVRareGroupJKQXZ字母在分组中的位置可能会发生变化,但很少会出现在其他的分组中去。SingleFrequencyReasoningThingstolookforinafrequencyreportIftherearehillsandvalleyssimilartostandardEnglishthenthecipherismostlikelyasubstitution,so(密文字母频率的高峰低谷部分)•Findthebreakbetweenhighfrequencyandmediumfrequency(lookfora2%dropbetweentwoletters)•Themostfrequentletterisprobably“e”oratleast“t”or“a”WARNING:thisisonlyusefulifyouhaveenoughtexttomaintainthe“average”pictureoffrequencydistributionsFrequencyReportAgainconsiderthefrequencycountforthechallenge:NHOGTUAFCYJXZEWIQBKVLMPDRS3626252323201717131312987655433221000Whereisthebreak-thatis,whichsetofcharactersareinthehighfrequencygroup?Outofthepossiblehighfrequencygroupwhichise?ChallengeDigramsThischartliststhedigramsformedbythemostfrequentlettersintheciphertext:Firsttask-identify(orconfirm)eNisagoodpossibilitybyfrequencycountsNalsocontactsmorecharactersthananyother(17-lookatthefulldigramtable)NHOGTUAFN03041013H12424112O04061001G51420203T42700421U51103002A51223000F70100340确定字母EConsonants(辅音)TheeasiesttospotisNbecause80%ofthelettersthatprecedenarevowels(字母N前的字母80%为元音字母)lookforahighfrequencyletterwhichmostoftenfollowsavowelforthechallengetext,Tfollowsoneofthevowels(N,O,U,A)17outof23timeshfrequentlyappearsbeforeeandalmostneverafterit(h通常在e前)inthechallenge,thepairYNoccursfrequentlybutNYneveroccursthiscommonifYisreallyh,thenHmustbetbecausethiscommon有用的经验thhe组合非常常见CurrentStatus(当前状态)Usingourbestguess,thekeylookslikeplain:ABCDEFGHIJKLMNOPQRSTUVWXYZcipher:UNYOTAH1.h—t,y—h,n—e二连三连2.T—n(ot,nt较多)3.ot—in还是ot—on?4.U—a,A--oChallengeTextGJXXNGGOTZNUCOTWMOHYJTKTAMTXOBYNFGOGINUGEINEAINITHNNONIHEIEAJFNZVQHYNGNEAJFHYOTWGOTHY