# Grdl. Krypto - Lab. 02 - Vertraulichkeit ## Schlüssellängen | | 1 Prozessor | 1000 Prozessoren | 1 000 000 Prozessoren | | - | - | - | - | | 1 Tag Zeit | 36 Bit | 46 Bit | 56 Bit | | 1 Woche Zeit | 39 Bit | 49 Bit | 59 Bit | | 1 Jahr Zeit | 44 Bit | 54 Bit | 64 Bit | | 50 Jahre Zeit | 50 Bit | 60 Bit | 70 Bit | - Das Knacken eines 80-, 128- bzw. 256-Bit Schlüssels würde um etliche Vielfache länger als 50 Jahre benötigen --> Für einen 80 Bit Schlüssel auf 1 Millionen Prozessoren bereits mehr als 38 Millionen Jahre. ## Substitutionschiffre **Vorgehensweise:** - Programm schreiben zum Zählen der einzelnen Buchstaben - Häufigkeitsanalyse durchführen --> welche Buchstaben kommen im Text mit welcher (relativen) Häufigkeit vor **vs** wie sind die Häufigkeiten im englischen Alphabet - Dann zuerst Trigramme ersetzen (urz = the) und anschließend einzelne Buchstaben des Chiffretexts durch Buchstaben der Häufigkeitsanalyse ersetzen - Restliche unentschlüsselte Buchstaben anschauen und überlegen welche Buchstaben ein sinnvolles Wort ergeben würden. So nach und nach weitere Buchstaben entschlüsseln (urzh --> they/then --> h einmal durch y, einmal durch n ersetzen --> was ergibt mehr Sinn?). --> Text anschauen und ausprobieren. **Tools:** - https://www.cryptool.org/de/cto/frequency-analysis - http://www.practicalcryptography.com/cryptanalysis/letter-frequencies-various-languages/english-letter-frequencies/ **Schlüssel** a = f b = d c = q d = s e = x f = r g = k h = y j = j i = c k = p l = w m = a n = g o = m p = u q = o r = h s = l t = b u = t v = v w = z x = i y = n z = e **Klartext:** ``` justtheplaceforasnarkthebellmancried ashelandedhiscrewwithcare supportingeachmanonthetopofthetide byafingerentwinedinhishair justtheplaceforasnarkihavesaidittwice thataloneshouldencouragethecrew justtheplaceforasnarkihavesaiditthrice whatitellyouthreetimesistrue thecrewwascompleteitincludedaboots amakerofbonnetsandhoods abarristerbroughttoarrangetheirdisputes andabrokertovaluetheirgoods abilliardmakerwhoseskillwasimmense mightperhapshavewonmorethanhisshare butabankerengagedatenormousexpense hadthewholeoftheircashinhiscare therewasalsoabeaverthatpacedonthedeck orwouldsitmakinglaceinthebow andhadoftenthebellmansaidsavedthemfromwreck thoughnoneofthesailorsknewhow therewasonewhowasfamedforthenumberofthings heforgotwhenheenteredtheship hisumbrellahiswatchallhisjewelsandrings andtheclotheshehadboughtforthetrip hehadfortytwoboxesallcarefullypacked withhisnamepaintedclearlyoneach butsinceheomittedtomentionthefact theywereallleftbehindonthebeach thelossofhisclotheshardlymatteredbecause hehadsevencoatsonwhenhecame withthreepairsofbootsbuttheworstofitwas hehadwhollyforgottenhisname hewouldanswertohiortoanyloudcry suchasfrymeorfrittermywig towhatyoumaycallumorwhatwashisname butespeciallythingumajig whileforthosewhopreferredamoreforcibleword hehaddifferentnamesfromthese hisintimatefriendscalledhimcandleends andhisenemiestoastedcheese hisforminungainlyhisintellectsmall sothebellmanwouldoftenremark buthiscourageisperfectandthatafterall isthethingthatoneneedswithasnark hewouldjokewithhyenasreturningtheirstare withanimpudentwagofthehead andheoncewentawalkpawinpawwithabear justtokeepupitsspiritshesaid hecameasabakerbutownedwhentoolate anditdrovethepoorbellmanhalfmad hecouldonlybakebridecakeforwhichimaystate nomaterialsweretobehad thelastofthecrewneedsespecialremark thoughhelookedanincredibledunce hehadjustoneideabutthatonebeingsnark thegoodbellmanengagedhimatonce hecameasabutcherbutgravelydeclared whentheshiphadbeensailingaweek hecouldonlykillbeaversthebellmanlookedscared andwasalmosttoofrightenedtospeak butatlengthheexplainedinatremuloustone therewasonlyonebeaveronboard andthatwasatameonehehadofhisown whosedeathwouldbedeeplydeplored thebeaverwhohappenedtoheartheremark protestedwithtearsinitseyes thatnoteventheraptureofhuntingthesnark couldatoneforthatdismalsurprise itstronglyadvisedthatthebutchershouldbe conveyedinaseparateship butthebellmandeclaredthatwouldneveragree withtheplanshehadmadeforthetrip navigationwasalwaysadifficultart thoughwithonlyoneshipandonebell andhefearedhemustreallydeclineforhispart undertakinganotheraswell thebeaversbestcoursewasnodoubttoprocure asecondhanddaggerproofcoat sothebakeradviseditandnexttoinsure itslifeinsomeofficeofnote thisthebankersuggestedandofferedforhire onmoderatetermsorforsale twoexcellentpoliciesoneagainstfire andoneagainstdamagefromhail yetstilleverafterthatsorrowfulday wheneverthebutcherwasby thebeaverkeptlookingtheoppositeway andappearedunaccountablyshy justtheplaceforasnarkthebellmancried ashelandedhiscrewwithcare supportingeachmanonthetopofthetide byafingerentwinedinhishair justtheplaceforasnarkihavesaidittwice thataloneshouldencouragethecrew justtheplaceforasnarkihavesaiditthrice whatitellyouthreetimesistrue thecrewwascompleteitincludedaboots amakerofbonnetsandhoods abarristerbroughttoarrangetheirdisputes andabrokertovaluetheirgoods abilliardmakerwhoseskillwasimmense mightperhapshavewonmorethanhisshare butabankerengagedatenormousexpense hadthewholeoftheircashinhiscare therewasalsoabeaverthatpacedonthedeck orwouldsitmakinglaceinthebow andhadoftenthebellmansaidsavedthemfromwreck thoughnoneofthesailorsknewhow therewasonewhowasfamedforthenumberofthings heforgotwhenheenteredtheship hisumbrellahiswatchallhisjewelsandrings andtheclotheshehadboughtforthetrip hehadfortytwoboxesallcarefullypacked withhisnamepaintedclearlyoneach butsinceheomittedtomentionthefact theywereallleftbehindonthebeach thelossofhisclotheshardlymatteredbecause hehadsevencoatsonwhenhecame withthreepairsofbootsbuttheworstofitwas hehadwhollyforgottenhisname hewouldanswertohiortoanyloudcry suchasfrymeorfrittermywig towhatyoumaycallumorwhatwashisname butespeciallythingumajig whileforthosewhopreferredamoreforcibleword hehaddifferentnamesfromthese hisintimatefriendscalledhimcandleends andhisenemiestoastedcheese hisforminungainlyhisintellectsmall sothebellmanwouldoftenremark buthiscourageisperfectandthatafterall isthethingthatoneneedswithasnark hewouldjokewithhyenasreturningtheirstare withanimpudentwagofthehead andheoncewentawalkpawinpawwithabear justtokeepupitsspiritshesaid hecameasabakerbutownedwhentoolate anditdrovethepoorbellmanhalfmad hecouldonlybakebridecakeforwhichimaystate nomaterialsweretobehad thelastofthecrewneedsespecialremark thoughhelookedanincredibledunce hehadjustoneideabutthatonebeingsnark thegoodbellmanengagedhimatonce hecameasabutcherbutgravelydeclared whentheshiphadbeensailingaweek hecouldonlykillbeaversthebellmanlookedscared andwasalmosttoofrightenedtospeak butatlengthheexplainedinatremuloustone therewasonlyonebeaveronboard andthatwasatameonehehadofhisown whosedeathwouldbedeeplydeplored thebeaverwhohappenedtoheartheremark protestedwithtearsinitseyes thatnoteventheraptureofhuntingthesnark couldatoneforthatdismalsurprise itstronglyadvisedthatthebutchershouldbe conveyedinaseparateship butthebellmandeclaredthatwouldneveragree withtheplanshehadmadeforthetrip navigationwasalwaysadifficultart thoughwithonlyoneshipandonebell andhefearedhemustreallydeclineforhispart undertakinganotheraswell thebeaversbestcoursewasnodoubttoprocure asecondhanddaggerproofcoat sothebakeradviseditandnexttoinsure itslifeinsomeofficeofnote thisthebankersuggestedandofferedforhire onmoderatetermsorforsale twoexcellentpoliciesoneagainstfire andoneagainstdamagefromhail yetstilleverafterthatsorrowfulday wheneverthebutcherwasby thebeaverkeptlookingtheoppositeway andappearedunaccountablyshy theyrousedhimwithmuffinstheyrousedhimwithice theyrousedhimwithmustardandcress theyrousedhimwithjamandjudiciousadvice theysethimconundrumstoguess whenatlengthhesatupandwasabletospeak hissadstoryheofferedtotell andthebellmancriedsilencenotevenashriek andexcitedlytingledhisbell therewassilencesupremenotashrieknotascream scarcelyevenahowloragroan asthemantheycalledhotoldhisstoryofwoe inanantediluviantone myfatherandmotherwerehonestthoughpoor skipallthatcriedthebellmaninhaste ifitoncebecomesdarktheresnochanceofasnark wehavehardlyaminutetowaste iskipfortyyearssaidthebakerintears andproceedwithoutfurtherremark tothedaywhenyoutookmeaboardofyourship tohelpyouinhuntingthesnark adearuncleofmineafterwhomiwasnamed remarkedwhenibadehimfarewell ohskipyourdearunclethebellmanexclaimed asheangrilytingledhisbell heremarkedtomethensaidthatmildestofmen ifyoursnarkbeasnarkthatisright fetchithomebyallmeansyoumayserveitwithgreens anditshandyforstrikingalight youmayseekitwiththimblesandseekitwithcare youmayhuntitwithforksandhope youmaythreatenitslifewitharailwayshare youmaycharmitwithsmilesandsoap thatsexactlythemethodthebellmanbold inahastyparenthesiscried thatsexactlythewayihavealwaysbeentold thatthecaptureofsnarksshouldbetried butohbeamishnephewbewareoftheday ifyoursnarkbeaboojumforthen youwillsoftlyandsuddenlyvanishaway andneverbemetwithagain itisthisitisthisthatoppressesmysoul whenithinkofmyuncleslastwords andmyheartislikenothingsomuchasabowl brimmingoverwithquiveringcurds itisthisitisthiswehavehadthatbefore thebellmanindignantlysaid andthebakerrepliedletmesayitoncemore itisthisitisthisthatidread iengagewiththesnarkeverynightafterdark inadreamydeliriousfight iserveitwithgreensinthoseshadowyscenes andiuseitforstrikingalight butifeverimeetwithaboojumthatday inamomentofthisiamsure ishallsoftlyandsuddenlyvanishaway andthenotionicannotendure thebellmanlookeduffishandwrinkledhisbrow ifonlyyoudspokenbefore itsexcessivelyawkwardtomentionitnow withthesnarksotospeakatthedoor weshouldallofusgrieveasyouwellmaybelieve ifyouneverweremetwithagain butsurelymymanwhenthevoyagebegan youmighthavesuggesteditthen itsexcessivelyawkwardtomentionitnow asithinkivealreadyremarked andthemantheycalledhirepliedwithasigh iinformedyouthedayweembarked youmaychargemewithmurderorwantofsense weareallofusweakattimes buttheslightestapproachtoafalsepretense wasneveramongmycrimes isaiditinhebrewisaiditindutch isaiditingermanandgreek butiwhollyforgotanditvexesmemuch thatenglishiswhatyouspeak tisapitifultalesaidthebellmanwhoseface hadgrownlongerateveryword butnowthatyouvestatedthewholeofyourcase moredebatewouldbesimplyabsurd therestofmyspeechheexplainedtohismen youshallhearwheniveleisuretospeakit butthesnarkisathandletmetellyouagain tisyourgloriousdutytoseekit toseekitwiththimblestoseekitwithcare topursueitwithforksandhope tothreatenitslifewitharailwayshare tocharmitwithsmilesandsoap forthesnarksapeculiarcreaturethatwont becaughtinacommonplaceway doallthatyouknowandtryallthatyoudont notachancemustbewastedtoday forenglandexpectsiforbeartoproceed tisamaximtremendousbuttrite andyoudbestbeunpackingthethingsthatyouneed torigyourselvesoutforthefight thenthebankerendorsedablankcheckwhichhecrossed andchangedhisloosesilverfornotes thebakerwithcarecombedhiswhiskersandhair andshookthedustoutofhiscoats thebootsandthebrokerweresharpeningaspade eachworkingthegrindstoneinturn butthebeaverwentonmakinglaceanddisplayed nointerestintheconcern thoughthebarristertriedtoappealtoitspride andvainlyproceededtocite anumberofcasesinwhichmakinglaces hadbeenprovedaninfringementofright themakerofbonnetsferociouslyplanned anovelarrangementofbows whilethebilliardmarkerwithquiveringhand waschalkingthetipofhisnose butthebutcherturnednervousanddressedhimselffine withyellowkidglovesandaruff saidhefeltitexactlylikegoingtodine whichthebellmandeclaredwasallstuff introducemenowtheresagoodfellowhesaid ifwehappentomeetittogether andthebellmansagaciouslynoddinghishead saidthatmustdependontheweather thebeaverwentsimplygalumphingabout atseeingthebutchersoshy andeventhebakerthoughstupidandstout madeanefforttowinkwithoneeye beamansaidthebellmaninwrathasheheard thebutcherbeginningtosob shouldwemeetwithajubjubthatdesperatebird weshallneedallourstrengthforthejob theysoughtitwiththimblestheysoughtitwithcare theypursueditwithforksandhope theythreateneditslifewitharailwayshare theycharmeditwithsmilesandsoap thenthebutchercontrivedaningeniousplan formakingaseparatesally andfixedonaspotunfrequentedbyman adismalanddesolatevalley buttheverysameplantothebeaveroccurred ithadchosentheverysameplace yetneitherbetrayedbyasignoraword thedisgustthatappearedinhisface eachthoughthewasthinkingofnothingbutsnark andthegloriousworkoftheday andeachtriedtopretendthathedidnotremark thattheotherwasgoingthatway butthevalleygrewnarrowandnarrowerstill andtheeveninggotdarkerandcolder tillmerelyfromnervousnessnotfromgoodwill theymarchedalongshouldertoshoulder thenascreamshrillandhighrenttheshudderingsky andtheyknewthatsomedangerwasnear thebeaverturnedpaletothetipofitstail andeventhebutcherfeltqueer hethoughtofhischildhoodleftfarfarbehind thatblissfulandinnocentstate thesoundsoexactlyrecalledtohismind apencilthatsqueaksonaslate tisthevoiceofthejubjubhesuddenlycried thismanthattheyusedtocalldunce asthebellmanwouldtellyouheaddedwithpride ihaveutteredthatsentimentonce tisthenoteofthejubjubkeepcountientreat youwillfindihavetoldityoutwice tisthesongofthejubjubtheproofiscomplete ifonlyivestateditthrice thebeaverhadcountedwithscrupulouscare attendingtoeveryword butitfairlylostheartandoutgrabeindespair whenthethirdrepetitionoccurred itfeltthatinspiteofallpossiblepains ithadsomehowcontrivedtolosecount andtheonlythingnowwastorackitspoorbrains byreckoninguptheamount twoaddedtooneifthatcouldbutbedone itsaidwithonesfingersandthumbs recollectingwithtearshowinearlieryears ithadtakennopainswithitssums thethingcanbedonesaidthebutcherithink thethingmustbedoneiamsure thethingshallbedonebringmepaperandink thebestthereistimetoprocure thebeaverbroughtpaperportfoliopens andinkinunfailingsupplies whilestrangecreepycreaturescameoutoftheirdens andwatchedthemwithwonderingeyes soengrossedwasthebutcherheheededthemnot ashewrotewithapenineachhand andexplainedallthewhileinapopularstyle whichthebeavercouldwellunderstand takingthreeasthesubjecttoreasonabout aconvenientnumbertostate weaddsevenandtenandthenmultiplyout byonethousanddiminishedbyeight theresultweproceedtodivideasyousee byninehundredandninetytwo thensubtractseventeenandtheanswermustbe exactlyandperfectlytrue themethodemployediwouldgladlyexplain whileihaveitsoclearinmyhead ifihadbutthetimeandyouhadbutthebrain butmuchyetremainstobesaid inonemomentiveseenwhathashithertobeen envelopedinabsolutemystery andwithoutextrachargeiwillgiveyouatlarge alessoninnaturalhistory inhisgenialwayheproceededtosay forgettingalllawsofpropriety andthatgivinginstructionwithoutintroduction wouldhavecausedquiteathrillinsociety astotemperthejubjubsadesperatebird sinceitlivesinperpetualpassion itstasteincostumeisentirelyabsurd itisagesaheadofthefashion butitknowsanyfriendithasmetoncebefore itneverwilllookatabride andincharitymeetingsitstandsatthedoor andcollectsthoughitdoesnotsubscribe itsflavorwhencookedismoreexquisitefar thanmuttonoroystersoreggs somethinkitkeepsbestinanivoryjar andsomeinmahoganykegs youboilitinsawdustyousaltitinglue youcondenseitwithlocustsandtape stillkeepingoneprincipalobjectinview topreserveitssymmetricalshape thebutcherwouldgladlyhavetalkedtillnextday buthefeltthatthelessonmustend andheweptwithdelightinattemptingtosay heconsideredthebeaverhisfriend whilethebeaverconfessedwithaffectionatelooks moreeloquenteventhantears ithadlearnedintenminutesfarmorethanallbooks wouldhavetaughtitinseventyyears theyreturnedhandinhandandthebellmanunmanned foramomentwithnobleemotion saidthisamplyrepaysallthewearisomedays wehavespentonthebillowyocean suchfriendsasthebeaverandbutcherbecame haveseldomifeverbeenknown inwinterorsummertwasalwaysthesame youcouldnevermeeteitheralone andwhenquarrelsaroseasonefrequentlyfinds quarrelswillspiteofeveryendeavor thesongofthejubjubrecurredtotheirminds andcementedtheirfriendshipforever theysoughtitwiththimblestheysoughtitwithcare theypursueditwithforksandhope theythreateneditslifewitharailwayshare theycharmeditwithsmilesandsoap butthebarristerwearyofprovinginvain thatthebeaverslacemakingwaswrong fellasleepandindreamssawthecreaturequiteplain thathisfancyhaddweltonsolong hedreamedthathestoodinashadowycourt wherethesnarkwithaglassinitseye dressedingownbandsandwigwasdefendingapig onthechargeofdesertingitssty thewitnessesprovedwithouterrororflaw thatthestywasdesertedwhenfound andthejudgekeptexplainingthestateofthelaw inasoftundercurrentofsound theindictmenthadneverbeenclearlyexpressed anditseemedthatthesnarkhadbegun andhadspokenthreehoursbeforeanyoneguessed whatthepigwassupposedtohavedone thejuryhadeachformedadifferentview longbeforetheindictmentwasread andtheyallspokeatoncesothatnoneofthemknew onewordthattheothershadsaid youmustknowsaidthejudgebutthesnarkexclaimedfudge thatstatuteisobsoletequite letmetellyoumyfriendsthewholequestiondepends onanancientmanorialright inthematteroftreasonthepigwouldappear tohaveaidedbutscarcelyabetted whilethechargeofinsolvencyfailsitisclear ifyougrantthepleaneverindebted thefactofdesertioniwillnotdispute butitsguiltasitrustisremoved sofarasrelatedtothecostsofthissuit bythealibiwhichhasbeenproved mypoorclientsfatenowdependsonyouvotes herethespeakersatdowninhisplace anddirectedthejudgetorefertohisnotes andbrieflytosumupthecase butthejudgesaidheneverhadsummedupbefore sothesnarkundertookitinstead andsummeditsowellthatitcametofarmore thanthewitnesseseverhadsaid whentheverdictwascalledforthejurydeclined asthewordwassopuzzlingtospell buttheyventuredtohopethatthesnarkwouldntmind undertakingthatdutyaswell sothesnarkfoundtheverdictalthoughasitowned itwasspentwiththetoilsoftheday whenitsaidthewordguiltythejuryallgroaned andsomeofthemfaintedaway thenthesnarkpronouncedsentencethejudgebeingquite toonervoustoutteraword whenitrosetoitsfeettherewassilencelikenight andthefallofapinmightbeheard transportationforlifewasthesentenceitgave andthentobefinedfortypound thejuryallcheeredthoughthejudgesaidhefeared thatthephrasewasnotlegallysound buttheirwildexultationwassuddenlychecked whenthejailerinformedthemwithtears suchasentencewouldhavenottheslightesteffect asthepighadbeendeadforsomeyears thejudgeleftthecourtlookingdeeplydisgusted butthesnarkthoughalittleaghast asthelawyertowhomthedefensewasentrusted wentbellowingontothelast thusthebarristerdreamedwhilethebellowingseemed togroweverymomentmoreclear tillhewoketotheknellofafuriousbell whichthebellmanrangcloseathisear theysoughtitwiththimblestheysoughtitwithcare theypursueditwithforksandhope theythreateneditslifewitharailwayshare theycharmeditwithsmilesandsoap andthebankerinspiredwithacouragesonew itwasmatterforgeneralremark rushedmadlyaheadandwaslosttotheirview inhiszealtodiscoverthesnark butwhilehewasseekingwiththimblesandcare abandersnatchswiftlydrewnigh andgrabbedatthebankerwhoshriekedindespair forheknewitwasuselesstofly heofferedlargediscountheofferedacheck drawntobearerforsevenpoundsten butthebandersnatchmerelyextendeditsneck andgrabbedatthebankeragain withoutrestorpausewhilethosefrumiousjaws wentsavagelysnappingaround heskippedandhehoppedandheflounderedandflopped tillfaintinghefelltotheground thebandersnatchfledastheothersappeared ledonbythatfearstrickenyell andthebellmanremarkeditisjustasifeared andsolemnlytolledonhisbell hewasblackinthefaceandtheyscarcelycouldtrace theleastlikenesstowhathehadbeen whilesogreatwashisfrightthathiswaistcoatturnedwhite awonderfulthingtobeseen tothehorrorofallwhowerepresentthatday heuproseinfulleveningdress andwithsenselessgrimacesendeavoredtosay whathistonguecouldnolongerexpress downhesankinachairranhishandsthroughhishair andchantedinmimsiesttones wordswhoseutterinanityprovedhisinsanity whileherattledacoupleofbones leavehimheretohisfateitisgettingsolate thebellmanexclaimedinafright wehavelosthalfthedayanyfurtherdelay andweshantcatchasnarkbeforenight theysoughtitwiththimblestheysoughtitwithcare theypursueditwithforksandhope theythreateneditslifewitharailwayshare theycharmeditwithsmilesandsoap theyshudderedtothinkthatthechasemightfail andthebeaverexcitedatlast wentboundingalongonthetipofitstail forthedaylightwasnearlypast thereisthingumbobshoutingthebellmansaid heisshoutinglikemadonlyhark heiswavinghishandsheiswagginghishead hehascertainlyfoundasnark theygazedindelightwhilethebutcherexclaimed hewasalwaysadesperatewag theybeheldhimtheirbakertheirherounnamed onthetopofaneighboringcrag erectandsublimeforonemomentoftime inthenextthatwildfiguretheysaw asifstungbyaspasmplungeintoachasm whiletheywaitedandlistenedinawe itsasnarkwasthesoundthatfirstcametotheirears andseemedalmosttoogoodtobetrue thenfollowedatorrentoflaughterandcheers thentheominouswordsitsaboo thensilencesomefanciedtheyheardintheair awearyandwanderingsigh thensoundedlikejumbuttheothersdeclare itwasonlyabreezethatwentby theyhuntedtilldarknesscameonbuttheyfound notabuttonorfeatherormark bywhichtheycouldtellthattheystoodontheground wherethebakerhadmetwiththesnark inthemidstofthewordhewastryingtosay inthemidstofhislaughterandglee hehadsoftlyandsuddenlyvanishedaway forthesnarkwasaboojumyousee ``` ## Blockchiffre Es kann eine Häufigkeitsanalyse der Englischen Sprache auf Buchstabenpaare - Bigramme - durchgeführt werden (da ein ASCII-Symbol 8 Bit lang ist). Das kann dann mit den Häufigkeiten der verschlüsselten 16-Bit Blöcke abgeglichen werden und so der Klartext rekonstruiert werden. ## Vernam-Chiffre Eine Vernam-Chiffre mit dem Alphabet $\sum = \{a,b, \dots, z\}$ lässt sich realisieren, indem man den $xor$-Operator auf Kleinbuchstaben anpasst/erweitert, nach folgendem Muster: | $\oplus$ | $0$ | $1$ | | - | - | - | | $0$ | $0$ | $1$ | | $1$ | $1$ | $0$ | | $\oplus$ | $a$ | $b$ | $c$ | $d$ | $\dots$ | | - | - | - | - | - | - | | $a$ | $a$ | $b$ | $c$ | $d$ | $\dots$ | | $b$ | $b$ | $c$ | $d$ | $e$ | $\dots$ | | $c$ | $c$ | $d$ | $e$ | $f$ | $\dots$ | | $d$ | $d$ | $e$ | $f$ | $g$ | $\dots$ | ## Stromchiffre ### Antwort Der Angriffsvektor bei dieser Stromchiffre ist, dass der Klartext fortlaufend mit ein und demselben Bit-Zustand verschlüsselt/entschlüsselt wird. Das hängt damit zusammen, dass das LSB (das rechte äußere Bit) sich nach dem Startzustand nie mehr verändert, bei der Multiplikation mit 3 bleibt dieses immer gleich. Beispielsweise bleibt eine gerade Zahl gerade, entsprechend wäre das LSB 0. Gleichzeitig bleibt eine ungerade Zahl ungerade, entsprechend wäre das LSB 1. Somit kommen immer nur die Schlüsselströme 0000... 11111... in Frage. Gleichzeitig kennt man auch die Länge des Schlüsselstroms, da diese identisch zur Nachrichtenlänge ist. Damit gibt es zu jedem Chiffretext nur zwei mögliche Klartexte -> ein Brute-Force ist problemlos möglich, den initial verwendeten Schlüssel muss man gar nicht kennen. ### Vorüberlegung: Wir knacken eine Stromchiffre **Gegeben**: * 128 Bit Schlüssel * 128 Bit IV **Initialisierung**: * Summe aus Schlüssel und IV (Annahme: Sollte das Ergebnis 129 Bit betragen wird das vorderste Bit weggeworfen) **Verschlüsselung**: * Der Strom besteht jeweils aus dem LSB des Generator Zustandes * Wird ein Bit angefordert wird der Zustand im Generator verdreifacht **Schwachstelle**: * Eine Verdreifachung des Wertes verändert nicht das letzte Bit * Der Generator-Schlüssel-Strom ist daher entweder 0 oder 1 => Reduzierung der Möglichkeiten auf nur noch 2 verschiedene Schlüsselströme ## Modes of Operation ### CBC: ### ![](https://i.imgur.com/wZTQ1IH.png) ![](https://i.imgur.com/2jUn4aq.png) **Vorteile:** * Durch XOR - Verknüpfung von Klartext und Nonce werden Auffälligkeiten im Klartext verschleiert (AAA --> F81). * Risiko für identische Geheimblöcke gering, da diese nur auftreten, wenn Schlüssel und Initialisierungsvektor wiederholt verwendet werden. * Identische Klartextblöcke (innerhalb eines Klartexts) führen zu unterschiedlichen Schlüsseltextblöcken (Blockverkettung) --> verhindert Known - Plain - Text Angriffe **Nachteile:** * Der übertragende Chiffretext offenbart die Länge der übertragenden Nachricht * Entschlüsselung eines Blocks Geheimtexts hängt vom vorherigen Block ab --> einzelner Bitfehler im vorangegangen Block führt zu Fehlern in allen nachfolgenden. * Reihenfolge ebenfalls wichtig, ändert sich diese, ändert sich die Entschlüsselung und ein falscher Klartext entsteht. ### CTR: ### ![](https://i.imgur.com/yJRIhNt.png) **Vorteile:** * Ver - und Entschlüsselung parallel machbar (sind identisch) --> besonders geeignet für Massendaten. * Ein fehlerhaft verschlüsseltes Bit, hat nur ein fehlerhaftes entschlüsseltes Bit zur Folge --> beeinflusst andere Blöcke nicht. **Nachteile:** * Der übertragende Chiffretext offenbart die Länge der übertragenden Nachricht * Kommen Blöcke in der falschen Reihenfolge an oder gehen verloren, lassen sich die darauffolgenden Blöcke nicht mehr entschlüsseln * Ist der Zähler zu gering, kommt es zu einer Wiederholung und daraus lässt sich dann der Schlüssel bruteforcen. ### OFB (Output Feedback Mode): **Funktionsweise:** Blockalgorithmus (DES/AES) wird genutzt, um daraus (synchrone) Stromchiffre zu erstellen. Ausgabe der Blockchiffre wird mit dem Klartext bitweise per XOR verknüpft, um daraus den Geheimtext zu bilden. ![](https://i.imgur.com/Wb0fPzU.png) Bitstrom pseudozufällig weil er von Blockchiffre, Schlüssel und Initialisierungsvektor abhängt = Pseudo One - Time - Pad. Der Initialisierungsvektor ist ähnlich wie bei CBC als Startwert zu sehen und vom gewählten (geheimen) Schlüssel unabhängig. **Vorteile:** * Bitfehler in der Übertragung führen nur zu Bitfehlern (an entsprechender Stelle) in Entschlüsselung (XOR). * Bitfolge - mit der Klartext per XOR verschlüsselt wird - vorab berechenbar. * Keine separate Entschlüsselungsfunktion notwendig, auch für die Entschlüsselung wird einfach der IV/Nonce **verschlüsselt** und mit dem Ciphertext gexort. **Nachteile:** * Mehrere Nachrichten verschlüsseln --> jede benötigt anderen Initalisierungsvektor oder anderen Schlüssel, ansonsten entsteht selber Schlüsselstrom -> Schlüsselströme löschen sich aus, und das XOR der Ciphertexte wäre identisch zum XOR der Klartexte. Darauf lassen sich sich die Klartexte leicht ermitteln. * Falls zwei Ciphertexte basierend auf demselben Schlüssel/IV-Paar gebildet werden und einer der Klartexte bekannt ist, ließe sich der zweite problemlos entschlüsseln -> da beide den gleichen Schlüsselstrom verwenden würden, welcher sich durch XOR des bekannten Klartextes mit dem bekannten Ciphertext ermitteln ließe