From: Neil Smith Date: Thu, 24 Oct 2019 16:47:57 +0000 (+0100) Subject: Done challenge 3 X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=aa16a1b7a9e9d1eac959ec87791673b82ea9c7ae;p=cipher-tools.git Done challenge 3 --- diff --git a/2019/2019-challenge3.ipynb b/2019/2019-challenge3.ipynb new file mode 100644 index 0000000..7c3e75e --- /dev/null +++ b/2019/2019-challenge3.ipynb @@ -0,0 +1,419 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import os,sys,inspect\n", + "currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n", + "parentdir = os.path.dirname(currentdir)\n", + "sys.path.insert(0,parentdir) " + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [], + "source": [ + "from cipher.caesar import *\n", + "from cipher.affine import *\n", + "from cipher.keyword_cipher import *\n", + "from support.text_prettify import *\n", + "from support.utilities import *\n", + "from support.plot_frequency_histogram import *" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [], + "source": [ + "ca = open('3a.ciphertext').read()\n", + "cb = open('3b.ciphertext').read()\n", + "sca = sanitise(ca)\n", + "pca = letters(ca)\n", + "pta = depunctuate(ca)\n", + "\n", + "scb = sanitise(cb)\n", + "pcb = letters(cb)\n", + "ptb = depunctuate(cb)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "9 25 True \n", + "\n", + "Thaay, W phogen gr fe keaghwo gte irdg Huriir Geo aeurag aehiiy phdo’g ho hkkwneog dr W hdcen\n", + "haktwmed gr dehakt gte lwddwro uhuead wo khde gte rawqwohi aeurag thn feeo lwdswien. Gtey dehakten\n", + "emeaygtwoq hon krjino’g swon wg fjg gteo drleroe thn h fahwophme hon ktekcen gte Huriir eiemeo\n", + "swied. Gr emeayroe’d aeiwes gtey srjon wg gteae hon gte haktwmwdg aekcroen gthg drleroe qrg\n", + "nwdgahkgen. Pwgt gte mrijle rs lwddwro uhuead gtey hae thoniwoq gtwd wd org h djauawde, fjg qwmeo\n", + "gte wluraghoke rs gtede nrkjleogd wg wd h fwg hihalwoq hon nredo’g seei iwce gte phy OHDH jdjhiiy\n", + "nred gtwoqd. Hoyphy, gte swon dtrjin thme aehddjaen le, hon wg prjin thme ws W thno’g irrcen dr\n", + "khaesjiiy hg gte swie. Emeaygtwoq irrcen swoe evkeug gthg gte pran Wozekgwro wo gte ueojigwlhge\n", + "uhahqahut phd dueig pwgt ho W. Yrj lhy org fe djauawden, fjg ws yrj irrc hg gte nekayug rs gte\n", + "lhoqien meadwro wg wd lwddueig iozekgwro, pwgt ho i aeuihkwoq gte W. W prjino’g thme orgwken fjg W\n", + "thn nekayugen gte rawqwohi fy thon hon phd djauawden fy gte gyur. Wg dgjkc wo ly lwon dr pteo W dhp\n", + "gte swien meadwro pwgtrjg wg gthg ahoq hihal feiid. Roke pe dghagen womedgwqhgwoq pe irkcen ju gte\n", + "krlujgea swied dr W kho roiy hddjle gthg gte swien meadwro phd gahodkawfen fy drleroe ptr orp thd\n", + "hkkedd gr gte uawogen meadwro fjg ptr nredo’g thme gte kiehahoke gr hkkedd gte rawqwohi. Gte\n", + "xjedgwro wd, pty prjin gtey uarnjke h oep meadwro? W kho roiy gtwoc gthg gtey phogen gr tehn rss\n", + "lrae womedgwqhgwro fy qwmwoq jd h aehdro gr gtwoc wg phd hii h lwdghce hsgea hii. Ws gthg phd gte\n", + "uiho gteo wg thdo’g pracen. Wg deeld kieha gr le gthg drleroe aehiiy nred thme drlegtwoq gr twne. W\n", + "ktekcen gte dekjawgy kiehahoke iwdg hon gteae peae gpr tjonaen hon gtwagy-demeo ueruie pwgt hkkedd\n", + "gr gte haktwme arrl pteae pe hae dgrawoq gte womedgwqhgwro swied ptr nr org hidr thme kjaaeog hkkedd\n", + "gr gtrde krlujgea swied. Rs gtrde, roe tjonaen hon ewqtgeeo nwn thme gealwohi hkkedd fesrae pe\n", + "kirden wg nrpo, dr gte djduekg iwdg wd dtawocwoq, ptwkt W djuurde wd drlegtwoq, fjg W prjin uaesea\n", + "gr ohaarp wg nrpo h fwg lrae. Pwgt gte ihjokt rs Huriir Gpeime krlwoq ju oevg lrogt gte lrrn wd\n", + "qeggwoq geode hon W prjin aehiiy iwce gr lhce djae rja lwdktwes lhcea nredo’g thme hoy lrae\n", + "djauawded wo dgrae. Gr lhce lhggead prade W tehan gthg gte thpcd hg gte Ueoghqro hae qeggwoq\n", + "aedgiedd. Krjin yrj qeg rmea gteae hon swon rjg pthg gtey hae gtwocwoq? Qwmeo gthg rja graleogra\n", + "deeld gr thme uaeggy twqt-iemei hkkedd, lhyfe yrj krjin kahoc ju gte dekjawgy ro rja krlld? Lhyfe h\n", + "ceypran kwutea firkcen hd dghonhan? Leq\n" + ] + }, + { + "data": { + "text/plain": [ + "2558" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(m_a, s_a, o_a), score_a = affine_break(ca)\n", + "print(m_a, s_a, o_a, '\\n')\n", + "print(lcat(tpack(affine_decipher(ca, m_a, s_a, o_a).split())))" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('saturn', , -2573.856474269662)" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(key_a, wrap_a), score_a = keyword_break_mp(ca)\n", + "key_a, wrap_a, score_a" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "harry, i wanted to be certain the lost apollo ten report really wasn’t an accident so i asked\n", + "archives to search the mission papers in case the original report had been misfiled. they searched\n", + "everything and couldn’t find it but then someone had a brainwave and checked the apollo eleven\n", + "files. to everyone’s relief they found it there and the archivist reckoned that someone got\n", + "distracted. with the volume of mission papers they are handling this is not a surprise, but given\n", + "the importance of these documents it is a bit alarming and doesn’t feel like the way nasa usually\n", + "does things. anyway, the find should have reassured me, and it would have if i hadn’t looked so\n", + "carefully at the file. everything looked fine except that the word injection in the penultimate\n", + "paragraph was spelt with an i. you may not be surprised, but if you look at the decrypt of the\n", + "mangled version it is misspelt lnjection, with an l replacing the i. i wouldn’t have noticed but i\n", + "had decrypted the original by hand and was surprised by the typo. it stuck in my mind so when i saw\n", + "the filed version without it that rang alarm bells. once we started investigating we locked up the\n", + "computer files so i can only assume that the filed version was transcribed by someone who now has\n", + "access to the printed version but who doesn’t have the clearance to access the original. the\n", + "question is, why would they produce a new version? i can only think that they wanted to head off\n", + "more investigation by giving us a reason to think it was all a mistake after all. if that was the\n", + "plan then it hasn’t worked. it seems clear to me that someone really does have something to hide. i\n", + "checked the security clearance list and there were two hundred and thirty-seven people with access\n", + "to the archive room where we are storing the investigation files who do not also have current access\n", + "to those computer files. of those, one hundred and eighteen did have terminal access before we\n", + "closed it down, so the suspect list is shrinking, which i suppose is something, but i would prefer\n", + "to narrow it down a bit more. with the launch of apollo twelve coming up next month the mood is\n", + "getting tense and i would really like to make sure our mischief maker doesn’t have any more\n", + "surprises in store. to make matters worse i heard that the hawks at the pentagon are getting\n", + "restless. could you get over there and find out what they are thinking? given that our tormentor\n", + "seems to have pretty high-level access, maybe you could crank up the security on our comms? maybe a\n", + "keyword cipher blocked as standard? meg\n" + ] + } + ], + "source": [ + "print(lcat(tpack(keyword_decipher(ca, key_a, wrap_a).split())))" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Harry,\n", + "\n", + "I wanted to be certain the lost Apollo Ten report really wasn’t an accident so I asked archives to search the mission papers in case the original report had been misfiled. They searched everything and couldn’t find it but then someone had a brainwave and checked the Apollo eleven files. To everyone’s relief they found it there and the archivist reckoned that someone got distracted. With the volume of mission papers they are handling this is not a surprise, but given the importance of these documents it is a bit alarming and doesn’t feel like the way NASA usually does things. Anyway, the find should have reassured me, and it would have if I hadn’t looked so carefully at the file. Everything looked fine except that the word Injection in the penultimate paragraph was spelt with an I. You may not be surprised, but if you look at the decrypt of the mangled version it is misspelt lnjection, with an l replacing the I.\n", + "\n", + "I wouldn’t have noticed but I had decrypted the original by hand and was surprised by the typo. It stuck in my mind so when I saw the filed version without it that rang alarm bells. Once we started investigating we locked up the computer files so I can only assume that the filed version was transcribed by someone who now has access to the printed version but who doesn’t have the clearance to access the original. The question is, why would they produce a new version? I can only think that they wanted to head off more investigation by giving us a reason to think it was all a mistake after all. If that was the plan then it hasn’t worked. It seems clear to me that someone really does have something to hide.\n", + "\n", + "I checked the security clearance list and there were two hundred and thirty-seven people with access to the archive room where we are storing the investigation files who do not also have current access to those computer files. Of those, one hundred and eighteen did have terminal access before we closed it down, so the suspect list is shrinking, which I suppose is something, but I would prefer to narrow it down a bit more. With the launch of Apollo Twelve coming up next month the mood is getting tense and I would really like to make sure our mischief maker doesn’t have any more surprises in store.\n", + "\n", + "To make matters worse I heard that the hawks at the Pentagon are getting restless. Could you get over there and find out what they are thinking? Given that our tormentor seems to have pretty high-level access, maybe you could crank up the security on our comms? Maybe a keyword cipher blocked as standard?\n", + "\n", + "Meg\n", + "\n" + ] + }, + { + "data": { + "text/plain": [ + "2564" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "print(repunctuate(keyword_decipher(ca, key_a, wrap_a), pta))\n", + "open('3a.plaintext', 'w').write(repunctuate(keyword_decipher(ca, key_a, wrap_a), pta))" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('stunk', , -2377.4918717301703)" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(key_b, wrap_b), score_b = keyword_break_mp(scb)\n", + "key_b, wrap_b, score_b" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "MEGIS PENTL AOUPC EOFBL YSOVE RLTTD EPENT LGONH RIEFI NGTDE STLFF LNBTR YINGT OGLUG ETDEM OOBTD EREYO ULRER IGDTT DEDLW KSLRE GETTI NGPRE TTYRE STCES SLNBD LVEMO REORC ESSBE AIBEB LCREL BYTDL TTDES OVIET SLRET OHCLM EFORR EAENT EVENT SONTD ELPOC COPRO GRLMM ESOME OFTDE GENER LCSBO NTNEE BMUAD OFLNE XAUSE TOTUR NUPTD EDELT HUTYO UBONT GETFO URSTL RSWIT DOUTU NBERS TLNBI NGTDE NEEBF ORPOC ITIAL CSUPP ORTLN BTDER EDLSH EENLA ONAER TEBWD ISPER INGAL MPLIG NTOAO NVINA ETDEP RESIB ENTTO TLKEL STRON GCINE TDEMO STSTR IBENT LREAL CCING FORLC LRGEH UICBU POFFO RAESL CONGT DEHOR BERWI TDELS TGERM LNYLS LSDOW OFSTR ENGTD LRGUI NGTDL TTDEL TTLAK ONTDE SPLAE PROGR LMMEM USTDL VEHEE NLUTD ORISE BHYTD EPOCI THURO TDLTM LKESN OSENS ETOME FIRST TDERU SSILN SLREM ORECI KECYT OTRYT OWINT DEPRO PLGLN BLWLR TDLNT ORISK AONFC IATLN BSEAO NBTDE SLHOT LGEIF TDLTI SWDLT ITISI SNTSO PDIST IALTE BENOU GDFOR LKGHO PERLT IONHU TITIS DLRBT OAONV INAET DEGEN ERLCS TDLTT DLTIS TRUES OMEOF TDEMO REALU TIOUS PCLNN ERSMO STCYT DOSEW DOLAT ULCCY FOUGD TINTD ECLST WLRDL VEMLN LGEBT OHCOA KTDEH UICBU PPROP OSING LNEWT RLNAD EOFWL RGLME SINST ELBMO HICIS INGTD LTWLY ISSTI CCLPR OVOAL TIONH UTISC ESSCI KECYT OLAAI BENTL CCYTR IGGER LWLRE SPEAI LCCYI FWENO TIFYP LVCOV SKYIN LBVLN AELCC TDESL MEMYO WNTIM EINHE RCINA ONVIN AEBME WEDLV ETOTR ELBVE RYSOF TCYTD ERESO IDELB EBOVE RTOCL NGCEY LNBAO NVINA EBTDE MTOSU GGEST LNLCT ERNLT IVEWE WICCS TEPUP INSPE ATION SLTAD EAKPO INTAD LRCIE TOMLK EITDL RBERF ORSOV IETLG ENTST OAROS SLNBA RLNKU PTDET EUFEC SHERG CISTE NINGO PERLT IONTO SEEIF TDLTT URNSU PLNYT DINGR ECLTE BILML CSOGO INGTO SENBL AOUPC EOFOU RHEST OVERT OHLIK ONURT OTRYL NBFIN BOUTW DLTIS GOING ONTDE RETDE SOVIE TSLRE PRETT YSEAR ETIVE LHOUT TDEIR OWNSP LAEPR OGRLM MELNB WITDO UTTDE WORCB SPRES SWLTA DINGW EBONT RELCC YDLVE LACEL RPIAT UREOF TDEIR PROGR ESSOR TDEIR PCLNS UNCES STDEY LREAC OSETO PUTTI NGTDE IROWN MENON TDEMO ONIAL NTSEE WDLTT DEYDL VETOG LINWI TDWDL TSEEM STOHE LFLIR CYBIS ORGLN ISEBL TTEMP TTOBE RLICO URSPL AEPRO GRLMM EHUTI WOUCB STICC CIKET OKNOW WDLTT DEYLR EUPTO KEEPL ACOSE EYEON TDEMI SSION PCLNN INGLN BCETM EKNOW IFYOU DELRL NYTDI NGWOR RYING IWICC HEHLA KLHOU TLWEE KHEFO RETDE CLUNA DDLRR Y\n", + "\n" + ] + } + ], + "source": [ + "print(repunctuate(keyword_decipher(scb, key_b, wrap_b), ptb))" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 10 True \n", + "\n", + "MACFS PANTL IOUPK AOBJL YSOVA RLTTD APANT LCONE RFABF NCTDA STLBB LNJTR YFNCT OCLUC ATDAM OOJTD ARAYO ULRAR FCDTT DADLW HSLRA CATTF NCPRA TTYRA STKAS SLNJD LVAMO RAORK ASSJA IFJAJ LKRAL JYTDL TTDAS OVFAT SLRAT OEKLM ABORR AIANT AVANT SONTD ALPOK KOPRO CRLMM ASOMA OBTDA CANAR LKSJO NTNAA JMUID OBLNA XIUSA TOTUR NUPTD ADALT EUTYO UJONT CATBO URSTL RSWFT DOUTU NJARS TLNJF NCTDA NAAJB ORPOK FTFIL KSUPP ORTLN JTDAR ADLSE AANLI ONIAR TAJWD FSPAR FNCIL MPLFC NTOIO NVFNI ATDAP RASFJ ANTTO TLHAL STRON CKFNA TDAMO STSTR FJANT LRAIL KKFNC BORLK LRCAE UFKJU POBBO RIASL KONCT DAEOR JARWF TDALS TCARM LNYLS LSDOW OBSTR ANCTD LRCUF NCTDL TTDAL TTLIH ONTDA SPLIA PROCR LMMAM USTDL VAEAA NLUTD ORFSA JEYTD APOKF TEURO TDLTM LHASN OSANS ATOMA BFRST TDARU SSFLN SLRAM ORAKF HAKYT OTRYT OWFNT DAPRO PLCLN JLWLR TDLNT ORFSH IONBK FITLN JSAIO NJTDA SLEOT LCAFB TDLTF SWDLT FTFSF SNTSO PDFST FILTA JANOU CDBOR LHCEO PARLT FONEU TFTFS DLRJT OIONV FNIAT DACAN ARLKS TDLTT DLTFS TRUAS OMAOB TDAMO RAILU TFOUS PKLNN ARSMO STKYT DOSAW DOLIT ULKKY BOUCD TFNTD AKLST WLRDL VAMLN LCAJT OEKOI HTDAE UFKJU PPROP OSFNC LNAWT RLNID AOBWL RCLMA SFNST ALJMO EFKFS FNCTD LTWLY FSSTF KKLPR OVOIL TFONE UTFSK ASSKF HAKYT OLIIF JANTL KKYTR FCCAR LWLRA SPAIF LKKYF BWANO TFBYP LVKOV SHYFN LJVLN IALKK TDASL MAMYO WNTFM AFNEA RKFNI ONVFN IAJMA WADLV ATOTR ALJVA RYSOB TKYTD ARASO FDALJ AJOVA RTOKL NCKAY LNJIO NVFNI AJTDA MTOSU CCAST LNLKT ARNLT FVAWA WFKKS TAPUP FNSPA ITFON SLTID AIHPO FNTID LRKFA TOMLH AFTDL RJARB ORSOV FATLC ANTST OIROS SLNJI RLNHU PTDAT AUBAK SEARC KFSTA NFNCO PARLT FONTO SAAFB TDLTT URNSU PLNYT DFNCR AKLTA JFLML KSOCO FNCTO SANJL IOUPK AOBOU REAST OVART OELFH ONURT OTRYL NJBFN JOUTW DLTFS COFNC ONTDA RATDA SOVFA TSLRA PRATT YSAIR ATFVA LEOUT TDAFR OWNSP LIAPR OCRLM MALNJ WFTDO UTTDA WORKJ SPRAS SWLTI DFNCW AJONT RALKK YDLVA LIKAL RPFIT URAOB TDAFR PROCR ASSOR TDAFR PKLNS UNKAS STDAY LRAIK OSATO PUTTF NCTDA FROWN MANON TDAMO ONFIL NTSAA WDLTT DAYDL VATOC LFNWF TDWDL TSAAM STOEA LBLFR KYJFS ORCLN FSAJL TTAMP TTOJA RLFKO URSPL IAPRO CRLMM AEUTF WOUKJ STFKK KFHAT OHNOW WDLTT DAYLR AUPTO HAAPL IKOSA AYAON TDAMF SSFON PKLNN FNCLN JKATM AHNOW FBYOU DALRL NYTDF NCWOR RYFNC FWFKK EAELI HLEOU TLWAA HEABO RATDA KLUNI DDLRR Y\n", + "\n" + ] + } + ], + "source": [ + "(m_b, s_b, o_b), score_a = affine_break(scb)\n", + "print(m_b, s_b, o_b, '\\n')\n", + "print(affine_decipher(cb, m_b, s_b, o_b))\n", + "# open('3b.plaintext', 'w').write(affine_decipher(cb, m_b, s_b, o_b))" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('vostklmnpqruwxyzabcdefghij',\n", + " 'megispentacoupleofdaysoveratthepentagonbriefingthestaffandtryingtogaugethemoodthereyouarerightthehawksaregettingprettyrestlessandhavemoreorlessdecidedalreadythatthesovietsaretoblameforrecenteventsontheapolloprogrammesomeofthegeneralsdontneedmuchofanexcusetoturnuptheheatbutyoudontgetfourstarswithoutunderstandingtheneedforpoliticalsupportandtherehasbeenaconcertedwhisperingcampaigntoconvincethepresidenttotakeastronglinethemoststridentarecallingforalargebuildupofforcesalongtheborderwitheastgermanyasashowofstrengtharguingthattheattackonthespaceprogrammemusthavebeenauthorisedbythepolitburothatmakesnosensetomefirsttherussiansaremorelikelytotrytowinthepropagandawarthantoriskconflictandsecondthesabotageifthatiswhatitisisntsophisticatedenoughforakgboperationbutitishardtoconvincethegeneralsthatthatistruesomeofthemorecautiousplannersmostlythosewhoactuallyfoughtinthelastwarhavemanagedtoblockthebuildupproposinganewtrancheofwargamesinsteadmobilisingthatwayisstillaprovocationbutislesslikelytoaccidentallytriggerawarespeciallyifwenotifypavlovskyinadvanceallthesamemyowntimeinberlinconvincedmewehavetotreadverysoftlytheresoiheadedovertolangleyandconvincedthemtosuggestanalternativewewillstepupinspectionsatcheckpointcharlietomakeitharderforsovietagentstocrossandcrankuptheteufelsberglisteningoperationtoseeifthatturnsupanythingrelatediamalsogoingtosendacoupleofourbestovertobaikonurtotryandfindoutwhatisgoingontherethesovietsareprettysecretiveabouttheirownspaceprogrammeandwithouttheworldspresswatchingwedontreallyhaveaclearpictureoftheirprogressortheirplansunlesstheyareclosetoputtingtheirownmenonthemoonicantseewhattheyhavetogainwithwhatseemstobeafairlydisorganisedattempttoderailourspaceprogrammebutiwouldstillliketoknowwhattheyareuptokeepacloseeyeonthemissionplanningandletmeknowifyouhearanythingworryingiwillbebackaboutaweekbeforethelaunchharry')" + ] + }, + "execution_count": 69, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "key_b, score_b = simulated_annealing_break(scb, fitness=Ptrigrams)\n", + "key_b, keyword_decipher(scb, key_b, KeywordWrapAlphabet.from_last)" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "megis penta couple of days over at the pentagon briefing the staff and trying to gauge the mood\n", + "there you are right the hawks are getting pretty restless and have more or less decided already that\n", + "the soviets are to blame for recent events on the apollo programme some of the generals dont need\n", + "much of an excuse to turn up the heat but you dont get four stars without understanding the need for\n", + "political support and there has been a concerted whispering campaign to convince the president to\n", + "take a strong line the most strident are calling for a large buildup of forces along the border with\n", + "east germany as a show of strength arguing that the attack on the space programme must have been\n", + "authorised by the politburo that makes no sense to me first the russians are more likely to try to\n", + "win the propaganda war than to risk conflict and second the sabotage if that is what it is isnt\n", + "sophisticated enough for a kgb operation but it is hard to convince the generals that that is true\n", + "some of the more cautious planners mostly those who actually fought in the last war have managed to\n", + "block the buildup proposing a new tranche of wargames instead mobilising that way is still a\n", + "provocation but is less likely to accidentally trigger aware specially if we notify pavlovsky in\n", + "advance all the same my own time in berlin convinced me we have to tread very softly there so i\n", + "headed over to langley and convinced them to suggest an alternative we will step up inspections at\n", + "checkpoint charlie to make it harder for soviet agents to cross and crank up the teufel s berg\n", + "listening operation to see if that turns up anything related i am also going to send a couple of our\n", + "best over to baikonur to try and find out what is going on there the soviets are pretty secretive\n", + "about their own space programme and without the worlds press watching we dont really have a clear\n", + "picture of their progress or their plans unless they are close to putting their own men on the moon\n", + "icant see what they have to gain with what seems to be a fairly disorganised attempt to derail our\n", + "space programme but i would still like to know what they are up to keep a close eye on the mission\n", + "planning and let me know if you hear anything worrying i will be back about a week before the launch\n", + "harry\n" + ] + } + ], + "source": [ + "print(lcat(tpack(segment(keyword_decipher(scb, key_b, KeywordWrapAlphabet.from_last)))))" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "megis penta couple of days over at the pentagon briefing the staff and trying to gauge the mood\n", + "there you are right the hawks are getting pretty restless and have more or less decided already that\n", + "the soviets are to blame for recent events on the apollo programme some of the generals dont need\n", + "much of an excuse to turn up the heat but you dont get four stars without understanding the need for\n", + "political support and there has been a concerted whispering campaign to convince the president to\n", + "take a strong line the most strident are calling for a large buildup of forces along the border with\n", + "east germany as a show of strength arguing that the attack on the space programme must have been\n", + "authorised by the politburo that makes no sense to me first the russians are more likely to try to\n", + "win the propaganda war than to risk conflict and second the sabotage if that is what it is isnt\n", + "sophisticated enough for a kgb operation but it is hard to convince the generals that that is true\n", + "some of the more cautious planners mostly those who actually fought in the last war have managed to\n", + "block the buildup proposing a new tranche of wargames instead mobilising that way is still a\n", + "provocation but is less likely to accidentally trigger aware specially if we notify pavlovsky in\n", + "advance all the same my own time in berlin convinced me we have to tread very softly there so i\n", + "headed over to langley and convinced them to suggest an alternative we will step up inspections at\n", + "checkpoint charlie to make it harder for soviet agents to cross and crank up the teufel s berg\n", + "listening operation to see if that turns up anything related i am also going to send a couple of our\n", + "best over to baikonur to try and find out what is going on there the soviets are pretty secretive\n", + "about their own space programme and without the worlds press watching we dont really have a clear\n", + "picture of their progress or their plans unless they are close to putting their own men on the moon\n", + "icant see what they have to gain with what seems to be a fairly disorganised attempt to derail our\n", + "space programme but i would still like to know what they are up to keep a close eye on the mission\n", + "planning and let me know if you hear anything worrying i will be back about a week before the launch\n", + "harry\n" + ] + } + ], + "source": [ + "print(lcat(tpack(segment(keyword_decipher(scb, 'vostok', KeywordWrapAlphabet.from_last)))))" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2267" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "open('3b.plaintext', 'w').write(lcat(tpack(segment(keyword_decipher(scb, 'vostok', KeywordWrapAlphabet.from_last)))))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.8" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/2019/3a.ciphertext b/2019/3a.ciphertext new file mode 100644 index 0000000..ec6dfa2 --- /dev/null +++ b/2019/3a.ciphertext @@ -0,0 +1,11 @@ +Wshhp, + +X msdjru je ar trhjsxd jwr beij Sfebbe Jrd hrfehj hrsbbp msid’j sd sttxurdj ie X sizru shtwxlri je irshtw jwr cxiixed fsfrhi xd tsir jwr ehxvxdsb hrfehj wsu arrd cxinxbru. Jwrp irshtwru rlrhpjwxdv sdu tekbud’j nxdu xj akj jwrd iecredr wsu s ahsxdmslr sdu twrtzru jwr Sfebbe rbrlrd nxbri. Je rlrhpedr’i hrbxrn jwrp nekdu xj jwrhr sdu jwr shtwxlxij hrtzedru jwsj iecredr vej uxijhstjru. Mxjw jwr lebkcr en cxiixed fsfrhi jwrp shr wsdubxdv jwxi xi dej s ikhfhxir, akj vxlrd jwr xcfehjsdtr en jwrir uetkcrdji xj xi s axj sbshcxdv sdu uerid’j nrrb bxzr jwr msp DSIS kiksbbp ueri jwxdvi. Sdpmsp, jwr nxdu iwekbu wslr hrsiikhru cr, sdu xj mekbu wslr xn X wsud’j beezru ie tshrnkbbp sj jwr nxbr. Rlrhpjwxdv beezru nxdr rotrfj jwsj jwr mehu Xdyrtjxed xd jwr frdkbjxcsjr fshsvhsfw msi ifrbj mxjw sd X. Pek csp dej ar ikhfhxiru, akj xn pek beez sj jwr urthpfj en jwr csdvbru lrhixed xj xi cxiifrbj bdyrtjxed, mxjw sd b hrfbstxdv jwr X. + +X mekbud’j wslr dejxtru akj X wsu urthpfjru jwr ehxvxdsb ap wsdu sdu msi ikhfhxiru ap jwr jpfe. Xj ijktz xd cp cxdu ie mwrd X ism jwr nxbru lrhixed mxjwekj xj jwsj hsdv sbshc arbbi. Edtr mr ijshjru xdlrijxvsjxdv mr betzru kf jwr tecfkjrh nxbri ie X tsd edbp siikcr jwsj jwr nxbru lrhixed msi jhsdithxaru ap iecredr mwe dem wsi sttrii je jwr fhxdjru lrhixed akj mwe uerid’j wslr jwr tbrshsdtr je sttrii jwr ehxvxdsb. Jwr gkrijxed xi, mwp mekbu jwrp fheuktr s drm lrhixed? X tsd edbp jwxdz jwsj jwrp msdjru je wrsu enn cehr xdlrijxvsjxed ap vxlxdv ki s hrsied je jwxdz xj msi sbb s cxijszr snjrh sbb. Xn jwsj msi jwr fbsd jwrd xj wsid’j mehzru. Xj irrci tbrsh je cr jwsj iecredr hrsbbp ueri wslr iecrjwxdv je wxur. + +X twrtzru jwr irtkhxjp tbrshsdtr bxij sdu jwrhr mrhr jme wkduhru sdu jwxhjp-irlrd frefbr mxjw sttrii je jwr shtwxlr heec mwrhr mr shr ijehxdv jwr xdlrijxvsjxed nxbri mwe ue dej sbie wslr tkhhrdj sttrii je jweir tecfkjrh nxbri. En jweir, edr wkduhru sdu rxvwjrrd uxu wslr jrhcxdsb sttrii arnehr mr tbeiru xj uemd, ie jwr ikifrtj bxij xi iwhxdzxdv, mwxtw X ikffeir xi iecrjwxdv, akj X mekbu fhrnrh je dshhem xj uemd s axj cehr. Mxjw jwr bskdtw en Sfebbe Jmrblr tecxdv kf droj cedjw jwr ceeu xi vrjjxdv jrdir sdu X mekbu hrsbbp bxzr je cszr ikhr ekh cxitwxrn cszrh uerid’j wslr sdp cehr ikhfhxiri xd ijehr. + +Je cszr csjjrhi mehir X wrshu jwsj jwr wsmzi sj jwr Frdjsved shr vrjjxdv hrijbrii. Tekbu pek vrj elrh jwrhr sdu nxdu ekj mwsj jwrp shr jwxdzxdv? Vxlrd jwsj ekh jehcrdjeh irrci je wslr fhrjjp wxvw-brlrb sttrii, cspar pek tekbu thsdz kf jwr irtkhxjp ed ekh tecci? Cspar s zrpmehu txfwrh abetzru si ijsdushu? + +Crv diff --git a/2019/3a.plaintext b/2019/3a.plaintext new file mode 100644 index 0000000..2cd2796 --- /dev/null +++ b/2019/3a.plaintext @@ -0,0 +1,11 @@ +Harry, + +I wanted to be certain the lost Apollo Ten report really wasn’t an accident so I asked archives to search the mission papers in case the original report had been misfiled. They searched everything and couldn’t find it but then someone had a brainwave and checked the Apollo eleven files. To everyone’s relief they found it there and the archivist reckoned that someone got distracted. With the volume of mission papers they are handling this is not a surprise, but given the importance of these documents it is a bit alarming and doesn’t feel like the way NASA usually does things. Anyway, the find should have reassured me, and it would have if I hadn’t looked so carefully at the file. Everything looked fine except that the word Injection in the penultimate paragraph was spelt with an I. You may not be surprised, but if you look at the decrypt of the mangled version it is misspelt lnjection, with an l replacing the I. + +I wouldn’t have noticed but I had decrypted the original by hand and was surprised by the typo. It stuck in my mind so when I saw the filed version without it that rang alarm bells. Once we started investigating we locked up the computer files so I can only assume that the filed version was transcribed by someone who now has access to the printed version but who doesn’t have the clearance to access the original. The question is, why would they produce a new version? I can only think that they wanted to head off more investigation by giving us a reason to think it was all a mistake after all. If that was the plan then it hasn’t worked. It seems clear to me that someone really does have something to hide. + +I checked the security clearance list and there were two hundred and thirty-seven people with access to the archive room where we are storing the investigation files who do not also have current access to those computer files. Of those, one hundred and eighteen did have terminal access before we closed it down, so the suspect list is shrinking, which I suppose is something, but I would prefer to narrow it down a bit more. With the launch of Apollo Twelve coming up next month the mood is getting tense and I would really like to make sure our mischief maker doesn’t have any more surprises in store. + +To make matters worse I heard that the hawks at the Pentagon are getting restless. Could you get over there and find out what they are thinking? Given that our tormentor seems to have pretty high-level access, maybe you could crank up the security on our comms? Maybe a keyword cipher blocked as standard? + +Meg diff --git a/2019/3b.ciphertext b/2019/3b.ciphertext new file mode 100644 index 0000000..a24ea19 --- /dev/null +++ b/2019/3b.ciphertext @@ -0,0 +1 @@ +WKMPC ZKXDV SYEZU KYLTV ICYFK BVDDN KZKXD VMYXO BPKLP XMDNK CDVLL VXTDB IPXMD YMVEM KDNKW YYTDN KBKIY EVBKB PMNDD NKNVG RCVBK MKDDP XMZBK DDIBK CDUKC CVXTN VFKWY BKYBU KCCTK SPTKT VUBKV TIDNV DDNKC YFPKD CVBKD YOUVW KLYBB KSKXD KFKXD CYXDN KVZYU UYZBY MBVWW KCYWK YLDNK MKXKB VUCTY XDXKK TWESN YLVXK HSECK DYDEB XEZDN KNKVD OEDIY ETYXD MKDLY EBCDV BCGPD NYEDE XTKBC DVXTP XMDNK XKKTL YBZYU PDPSV UCEZZ YBDVX TDNKB KNVCO KKXVS YXSKB DKTGN PCZKB PXMSV WZVPM XDYSY XFPXS KDNKZ BKCPT KXDDY DVRKV CDBYX MUPXK DNKWY CDCDB PTKXD VBKSV UUPXM LYBVU VBMKO EPUTE ZYLLY BSKCV UYXMD NKOYB TKBGP DNKVC DMKBW VXIVC VCNYG YLCDB KXMDN VBMEP XMDNV DDNKV DDVSR YXDNK CZVSK ZBYMB VWWKW ECDNV FKOKK XVEDN YBPCK TOIDN KZYUP DOEBY DNVDW VRKCX YCKXC KDYWK LPBCD DNKBE CCPVX CVBKW YBKUP RKUID YDBID YGPXD NKZBY ZVMVX TVGVB DNVXD YBPCR SYXLU PSDVX TCKSY XTDNK CVOYD VMKPL DNVDP CGNVD PDPCP CXDCY ZNPCD PSVDK TKXYE MNLYB VRMOY ZKBVD PYXOE DPDPC NVBTD YSYXF PXSKD NKMKX KBVUC DNVDD NVDPC DBEKC YWKYL DNKWY BKSVE DPYEC ZUVXX KBCWY CDUID NYCKG NYVSD EVUUI LYEMN DPXDN KUVCD GVBNV FKWVX VMKTD YOUYS RDNKO EPUTE ZZBYZ YCPXM VXKGD BVXSN KYLGV BMVWK CPXCD KVTWY OPUPC PXMDN VDGVI PCCDP UUVZB YFYSV DPYXO EDPCU KCCUP RKUID YVSSP TKXDV UUIDB PMMKB VGVBK CZKSP VUUIP LGKXY DPLIZ VFUYF CRIPX VTFVX SKVUU DNKCV WKWIY GXDPW KPXOK BUPXS YXFPX SKTWK GKNVF KDYDB KVTFK BICYL DUIDN KBKCY PNKVT KTYFK BDYUV XMUKI VXTSY XFPXS KTDNK WDYCE MMKCD VXVUD KBXVD PFKGK GPUUC DKZEZ PXCZK SDPYX CVDSN KSRZY PXDSN VBUPK DYWVR KPDNV BTKBL YBCYF PKDVM KXDCD YSBYC CVXTS BVXRE ZDNKD KELKU COKBM UPCDK XPXMY ZKBVD PYXDY CKKPL DNVDD EBXCE ZVXID NPXMB KUVDK TPVWV UCYMY PXMDY CKXTV SYEZU KYLYE BOKCD YFKBD YOVPR YXEBD YDBIV XTLPX TYEDG NVDPC MYPXM YXDNK BKDNK CYFPK DCVBK ZBKDD ICKSB KDPFK VOYED DNKPB YGXCZ VSKZB YMBVW WKVXT GPDNY EDDNK GYBUT CZBKC CGVDS NPXMG KTYXD BKVUU INVFK VSUKV BZPSD EBKYL DNKPB ZBYMB KCCYB DNKPB ZUVXC EXUKC CDNKI VBKSU YCKDY ZEDDP XMDNK PBYGX WKXYX DNKWY YXPSV XDCKK GNVDD NKINV FKDYM VPXGP DNGNV DCKKW CDYOK VLVPB UITPC YBMVX PCKTV DDKWZ DDYTK BVPUY EBCZV SKZBY MBVWW KOEDP GYEUT CDPUU UPRKD YRXYG GNVDD NKIVB KEZDY RKKZV SUYCK KIKYX DNKWP CCPYX ZUVXX PXMVX TUKDW KRXYG PLIYE NKVBV XIDNP XMGYB BIPXM PGPUU OKOVS RVOYE DVGKK ROKLY BKDNK UVEXS NNVBB I diff --git a/2019/3b.plaintext b/2019/3b.plaintext new file mode 100644 index 0000000..55d6944 --- /dev/null +++ b/2019/3b.plaintext @@ -0,0 +1,24 @@ +megis penta couple of days over at the pentagon briefing the staff and trying to gauge the mood +there you are right the hawks are getting pretty restless and have more or less decided already that +the soviets are to blame for recent events on the apollo programme some of the generals dont need +much of an excuse to turn up the heat but you dont get four stars without understanding the need for +political support and there has been a concerted whispering campaign to convince the president to +take a strong line the most strident are calling for a large buildup of forces along the border with +east germany as a show of strength arguing that the attack on the space programme must have been +authorised by the politburo that makes no sense to me first the russians are more likely to try to +win the propaganda war than to risk conflict and second the sabotage if that is what it is isnt +sophisticated enough for a kgb operation but it is hard to convince the generals that that is true +some of the more cautious planners mostly those who actually fought in the last war have managed to +block the buildup proposing a new tranche of wargames instead mobilising that way is still a +provocation but is less likely to accidentally trigger aware specially if we notify pavlovsky in +advance all the same my own time in berlin convinced me we have to tread very softly there so i +headed over to langley and convinced them to suggest an alternative we will step up inspections at +checkpoint charlie to make it harder for soviet agents to cross and crank up the teufel s berg +listening operation to see if that turns up anything related i am also going to send a couple of our +best over to baikonur to try and find out what is going on there the soviets are pretty secretive +about their own space programme and without the worlds press watching we dont really have a clear +picture of their progress or their plans unless they are close to putting their own men on the moon +icant see what they have to gain with what seems to be a fairly disorganised attempt to derail our +space programme but i would still like to know what they are up to keep a close eye on the mission +planning and let me know if you hear anything worrying i will be back about a week before the launch +harry \ No newline at end of file