Introduction
VirginiaCode(alsotranslatedasVergenalCode)istheuseofaseriesofCaesarcodestoformacodeTheencryptionalgorithmofthealphabetisasimpleformofmulti-tablecipher.
TheVirginiacipherhasbeeninventedmanytimes.ThismethodwasfirstrecordedinGiovanBattistaBellaso'sbook"TheCodeofMr.GiovanBattistaBellaso"(Italian:Lacifradel.Sig.GiovanBattistaBellaso).However,itwaslatermisrepresentedinthe19thcenturyasbeingcreatedbytheFrenchdiplomatBlaiseDeVigenère(BlaiseDeVigenère),soitisnowcalledthe"VirginiaCode".
TheVirginiacipherisknownforitssimplicityandeaseofuse,anditisusuallydifficultforbeginnerstocrack,soitisalsocalledthe"unbreakablecipher"(French:lechiffreindéchiffrable).ThisalsoallowsmanypeopletousetheVirginiaciphertoencryptitforthepurposeofcrackingit.
History
Themulti-tablepasswordwasfirstproposedbyLeonBattistaAlbertiaround1467.Heusedametalcipherdisctoswitchtheciphertable,butThissystemcanonlydosomelimitedconversions.Later,in1508,thetabularectainventedinJohannesTritmius'sSteganographia(Steganographia)becameakeypartoftheVirginiaCode.However,atthattime,thismethodcouldonlydosomesimpleandpredictableswitchingofthepasswordtable.ThisencryptiontechniqueisalsoknownastheTritmiuscipher.
Thismethodreallyappearedinthebook"GeovanBattistaBellaso'sArithmetic"writtenbyGeovanBattistaBellasoin1553.middle.HeisbasedonthetablemethodofTritmius,andatthesametimeintroducestheconceptofakey.
BrycedeVirginiainventedasimplerbutmoreeffectiveautokeycipherin1586duringHenryIII.Later,inthe19thcentury,Bellaso’smethodwasmistakenforbeingfirstinventedbyVirginia.DavidKahnexpressedregretaboutthisinTheCodebreakers,writingthat"historyignoredthisimportantcontributionandattributedittoVirginia,althoughhedidnotknowit".
Becauseofthedifficultyofdeciphering,theVirginiaCodehasgainedahighreputation.Thewell-knownauthorandmathematicianCharlesLutwigDodgson(pennameLouisCaro)describeditasundecipherableinTheAlphabetCipher(TheAlphabetCipher)editedbyhimin1868andcollectedinachildren’smagazine.of.In1917,"ScientificAmerican"referredtotheVirginiaCodeas"untransformable."However,theVirginiaCodeisnotworthyofsuchatitle.CharlesBabbagecompletedthedecipheringwork,buthedidnotpublishit.Later,FriedrichKasiskicompletelydecipheredandpublishedhismethodinthe19thcentury.Evenbeforethat,someseniorcryptanalystscouldoccasionallycrackitinthe16thcentury.
TheVirginiacipheriseasytouseenoughtomakeitabattlefieldcipher.Forexample,duringtheAmericanCivilWar,theConfederateArmyusedbrasscipherdiscstogenerateVirginiaciphers.TheNorthernArmywasoftenabletodeciphertheSouthernArmy’scode.Throughoutthewar,theSouthernArmymainlyusedthreekeys,namely"ManchesterBluff","CompleteVictory"and"ComeRetribution"attheendofthewar.
GilbertVernamtriedtopatchthecodethathadbeendeciphered(theVernam-Veniggiacodewascreatedin1918),butthiswastonoavail.However,Vernan'sinventioneventuallyledtothebirthoftheone-timepad,whichisatheoreticallyunbreakablepassword.
Description
InaCaesarcipher,eachletterinthealphabetwillbeoffset.Forexample,whentheoffsetis3,AwillbeconvertedtoDandBConvertedtoE...andtheVirginiacipheriscomposedofsomeCaesarcipherswithdifferentoffsets.
Inordertogenerateapassword,atablemethodisrequired.Thistable(showninFigure1)contains26rowsofthealphabet,eachrowisobtainedbyoffsettingthepreviousrowbyonebittotheleft.Whichlineofalphabetisusedtocompileisbasedonthekey,whichwillbeconstantlychangedintheprocess.
Forexample,supposetheplaintextis:
ATTACKATDAWN
Selectakeywordandrepeatittoobtainthekey.Forexample,whenthekeywordisLEMON,thekeyis:
LEMONLEMONLE
ForthefirstletterAoftheplaintext,itcorrespondstothefirstletterLofthekey,sousetheLlinealphabetinthetabletoencrypt,gettheciphertextAletterL.Similarly,thesecondletteroftheplaintextisT,andthecorrespondingrowEisusedforencryptioninthetabletoobtainthesecondletterXoftheciphertext.Byanalogy,youcanget:
Plaintext:ATTACKATDAWNKey:LEMONLEMONLEciphertext:LXFOPVEFRNHR
Thedecryptionprocessistheoppositeofencryption.Forexample:AccordingtotheLrowalphabetcorrespondingtothefirstletterLofthekey,itisfoundthatthefirstletterLoftheciphertextislocatedintheAcolumn,sothefirstletteroftheplaintextisA.ThesecondletterEofthekeycorrespondstothealphabetofrowE,andthesecondletterXoftheciphertextislocatedincolumnTofthisrow,sothesecondletteroftheplaintextisT.Byanalogy,theplaintextcanbeobtained.
Usingthenumbers0-25insteadofthelettersAZ,theencryptiongrammaroftheVirginiapasswordcanbewrittenintheformofcongruence:
Thedecryptionmethodcanbewrittenas:
PasswordDeciphering
ForallkindsofThedecipheringoftablecodesisbasedonletterfrequency,butdirectfrequencyanalysisisnotapplicable.Forexample,ifPisthemostfrequentletterintheciphertext,thenPislikelytocorrespondtoE(providedthatthelanguageoftheplaintextisEnglish).ThereasonisthatEisthemostfrequentlyusedletterinEnglish.However,sinceEcanbeencryptedintodifferentciphertextsintheVirginiacipher,simplefrequencyanalysisisnotusefulhere.
ThekeytodecipheringtheVirginiacipheristhatitskeyisrepeatedcyclically.Ifweknowthelengthofthekey,theciphertextcanbeseenasanintertwinedCaesarcipher,andeachofthemcanbecrackedseparately.UsetheKasiskitestandFriedmantesttogetthelengthofthekey.
TheKasiskiTest
FriedrichCassisfirstpublishedacompletemethodofdecipheringtheVirginiacodebasedon1863,calledKasiskiTest(Kasiskiexamination).Someoftheearlierdecipheringswerebasedontheknowledgeofplaintext,ortheuseofrecognizablewordsaskeys.However,Kasiski'smethoddoesnothavetheselimitations.However,beforethis,somepeoplehaverealizedthismethod.In1854,CharlesBabbagewasinspiredbyJohnHallBrockThwaites'sclaimintheJournaloftheSocietyoftheArtstohaveinventedthe"newcode",thusdecipheringVigieNiapassword.BabbagediscoveredthatSvetis’scipherwasjustavariantoftheVirginiacipher,andSvetischallengeditandaskedhimtotrytodeciphertheciphertextencryptedwithtwokeysofdifferentlengths.Babbagesuccessfullydeciphered,andtheplaintextobtainedwasthepoem"TheVisionofSin"writtenbyTennyson,andthekeyusedwasTennyson’swife’snameEmily..Babbageneverexplainedhismethod.InthestudyofBabbage'snotesduringhislifetime,itwasfoundthatBabbageusedthismethodasearlyas1846,whichisthesameasthemethodpublishedbyKasiskilater.
TheKasiskitestisbasedonthepossibilitythatcommonwordslikethemaybeencryptedbythesamekeyletter,andthusappearrepeatedlyintheciphertext.Forexample,differentCRYPTOsintheplaintextmaybeencryptedintodifferentciphertextsbythekeyABCDEF:
Key:ABCDEFABCDEFABCDEFABCDEFABCD
Plaintext:CRYPTOISSHORTFORCRYPTOGRAPHY
p>Ciphertext:CSASXTITUKSWTGQUGWYQVRKWAQJB
Atthistime,therepeatedelementsintheplaintextarenotrepeatedintheciphertext.However,ifthekeysarethesame,theresultmaybe(usingthekeyABCD):
Key:ABCDABCDABCDABCDABCDABCDABCD
Plaintext:CRYPTOISSHORTFORCRYPTOGRAPHY
p>Ciphertext:CSASTPKVSIQUTGQUCSASTPIUAQJB
Atthistime,theCassistestcanproduceresults.Thismethodismoreeffectiveforlongerparagraphs,becauseusuallytherearemorerepeatedsegmentsintheciphertext.Forexample,thelengthofthekeycanbedecipheredbythefollowingciphertext:
Ciphertext:DYDUXRMHTVDVNQDQNWDYDUXRMHARTJGWNQD
Amongthem,thetwoDYDUXRMHappear18lettersapart.Therefore,itcanbeassumedthatthelengthofthekeyisadivisorof18,thatis,thelengthis18,9,6,3,or2.ThetwoNQDsare20lettersapart,whichmeansthatthekeylengthshouldbe20,10,5,4,or2.Takingtheintersectionofthetwo,youcanbasicallydeterminethatthekeylengthis2.
TheFriedmanTest
TheFriedmanTestwasinventedbyWilliamF.Friedmaninthe1920s.Heusedtheindexofcoincidencetodescribetheunevennessoftheciphertextletterfrequency,therebydecipheringthecode.referstotheprobabilitythattwoarbitrarylettersinthetargetlanguagearethesame(0.067inEnglish),andreferstotheprobabilityofthisoccurrenceinthealphabet(1/26=inEnglish)0.0385),sothekeylengthcanbeestimatedas:
where,theobservationprobabilityis
where,creferstothelengthofthealphabet(26inEnglish),Nreferstothelengthofthetext,n1toncreferstotheletterfrequencyoftheciphertext,whichisaninteger.
Thismethodisonlyanestimateandwillbecomemoreaccurateasthelengthofthetextincreases.Inpractice,attemptsaremadetoapproachthisestimatedmultiplekeylength.Abettermethodistowritetheciphertextinmatrixform,wherethenumberofcolumnsisconsistentwiththeassumedkeylength,calculatethecoincidenceindexofeachcolumnseparately,andobtaintheaveragecoincidenceindex.Forallpossiblekeylengths,thehighestaveragecoincidenceindexismostlikelytobethetruekeylength.SuchatestcanbeusedasasupplementtotheKasiskitest.
Frequencyanalysis
Oncethelengthofthekeycanbedetermined,theciphertextcanberewrittenintomultiplecolumns,andthenumberofcolumnscorrespondstothelengthofthekey.Inthisway,eachcolumnisactuallyaCaesarcipher,andthekey(offset)ofthisciphercorrespondstothecorrespondingletteroftheVirginiacipherkey.TheciphertextcanbedecipheredbyamethodsimilartodecipheringtheCaesarcipher.
TheKirckhoffmethodwasproposedbyAugusteKerckhoffsasanimprovementoftheKasiskitest.Itcorrespondstheletterfrequencyofeachcolumnwiththeconvertedplaintextfrequencytoobtainthekeyletterofeachcolumn.Onceeachletterinthekeycanbedetermined,theciphertextcanbeeasilydecipheredtoobtaintheplaintext.IftheVirginiaalphabettableitselfismessyinsteadofintheusualalphabeticalorder,theKirkhoffmethodwillbeinvalid,buttheKasiskitestandrepetitionindexarestillvalidfordeterminingthekeylength.
Variants
VariationsoftheVirginiacipher,therollingkeycipher,wasonceconsideredundecipherable.Thekeyofthisvariantisconsistentwiththelengthoftheciphertext,sotheKasiskitestandFriedmantestbecomeinvalid.In1920,Friedmanfirstdiscoveredtheweaknessofthismethod.Sincethekeyoftherollingkeycipherisapieceofreallanguage,thedecipherercanunderstandthestatisticalinformationofthekeytext,andthisinformationwillalsobereflectedintheciphertext.
Ifthekeyiscompletelyrandom,consistentwiththelengthoftheplaintextandusedonlyonce,theVirginiacipheristheoreticallyundecipherable.However,inthiscase,thekeyitselfratherthantheciphertextbecomesthekey,whichiscalledaone-timepad.
VirginiaherselfindeedinventedastrongervariantofVirginiacipher-automatickeycipher.WhatBabbagedeciphersisactuallythiskindofautomatickeycipher,andKasiskiisusuallyconsideredtobethefirsttopublishamethodofdecipheringfixed-keymulti-tableciphers.
ThereisalsoasimplevariantthatusesVirginia'sdecodingmethodforencryption,whileusingVirginia'sencryptionmethodfordecryption,whichiscalledavariantBeaufortcipher.ThismethodisdifferentfromtheBeaufortciphercreatedbyFrancisBeaufort.AlthoughthelatterissimilartotheVirginiacipher,itusesamodifiedencryptionmethodandform,whichisakindofpeer-to-peerencryption.
TheapparentstrengthoftheVirginiacipherdidnotmakeitwidelyusedinEurope.TheGronsfeldciphercreatedbytheEarlofGronsfeldisbasicallythesameastheVirginiacipher,butitonlyuses10differentcipheralphabets(correspondingtoletters0to9).ThestrengthoftheGronsfeldcipherisveryhigh,becauseitskeyisnotaword,butthedisadvantageisthatthenumberofalphabetsistoosmall.Nevertheless,theGronsfeldcodeisstillwidelyusedinGermanyandthroughoutEurope.