Home teknologiaa Virginia Code

# Virginia Code

## Introduction

VirginiaCode(alsotranslatedasVergenalCode)istheuseofaseriesofCaesarcodestoformacodeTheencryptionalgorithmofthealphabetisasimpleformofmulti-tablecipher.

TheVirginiacipherisknownforitssimplicityandeaseofuse,anditisusuallydifficultforbeginnerstocrack,soitisalsocalledthe"unbreakablecipher"(French:lechiffreindéchiffrable).ThisalsoallowsmanypeopletousetheVirginiaciphertoencryptitforthepurposeofcrackingit.

## History

Thismethodreallyappearedinthebook"GeovanBattistaBellaso'sArithmetic"writtenbyGeovanBattistaBellasoin1553.middle.HeisbasedonthetablemethodofTritmius,andatthesametimeintroducestheconceptofakey.

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.

## Description

InaCaesarcipher,eachletterinthealphabetwillbeoffset.Forexample,whentheoffsetis3,AwillbeconvertedtoDandBConvertedtoE...andtheVirginiacipheriscomposedofsomeCaesarcipherswithdifferentoffsets.

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.

Thedecryptionmethodcanbewrittenas:

ForallkindsofThedecipheringoftablecodesisbasedonletterfrequency,butdirectfrequencyanalysisisnotapplicable.Forexample,ifPisthemostfrequentletterintheciphertext,thenPislikelytocorrespondtoE(providedthatthelanguageoftheplaintextisEnglish).ThereasonisthatEisthemostfrequentlyusedletterinEnglish.However,sinceEcanbeencryptedintodifferentciphertextsintheVirginiacipher,simplefrequencyanalysisisnotusefulhere.

ThekeytodecipheringtheVirginiacipheristhatitskeyisrepeatedcyclically.Ifweknowthelengthofthekey,theciphertextcanbeseenasanintertwinedCaesarcipher,andeachofthemcanbecrackedseparately.UsetheKasiskitestandFriedmantesttogetthelengthofthekey.

### TheKasiskiTest

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

### TheFriedmanTest

TheFriedmanTestwasinventedbyWilliamF.Friedmaninthe1920s.Heusedtheindexofcoincidencetodescribetheunevennessoftheciphertextletterfrequency,therebydecipheringthecode.referstotheprobabilitythattwoarbitrarylettersinthetargetlanguagearethesame(0.067inEnglish),andreferstotheprobabilityofthisoccurrenceinthealphabet(1/26=inEnglish)0.0385),sothekeylengthcanbeestimatedas:

where,theobservationprobabilityis

where,creferstothelengthofthealphabet(26inEnglish),Nreferstothelengthofthetext,n1toncreferstotheletterfrequencyoftheciphertext,whichisaninteger.

### Frequencyanalysis

Oncethelengthofthekeycanbedetermined,theciphertextcanberewrittenintomultiplecolumns,andthenumberofcolumnscorrespondstothelengthofthekey.Inthisway,eachcolumnisactuallyaCaesarcipher,andthekey(offset)ofthisciphercorrespondstothecorrespondingletteroftheVirginiacipherkey.TheciphertextcanbedecipheredbyamethodsimilartodecipheringtheCaesarcipher.

## Variants

VariationsoftheVirginiacipher,therollingkeycipher,wasonceconsideredundecipherable.Thekeyofthisvariantisconsistentwiththelengthoftheciphertext,sotheKasiskitestandFriedmantestbecomeinvalid.In1920,Friedmanfirstdiscoveredtheweaknessofthismethod.Sincethekeyoftherollingkeycipherisapieceofreallanguage,thedecipherercanunderstandthestatisticalinformationofthekeytext,andthisinformationwillalsobereflectedintheciphertext.