From: Neil Smith Date: Thu, 30 Nov 2017 21:44:33 +0000 (+0000) Subject: Done challenge 7 X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=5334c6e49cc35db0df35322a77ba0efe94a4abdd;p=cipher-tools.git Done challenge 7 --- diff --git a/2017/2017-challenge7.ipynb b/2017/2017-challenge7.ipynb new file mode 100644 index 0000000..318462d --- /dev/null +++ b/2017/2017-challenge7.ipynb @@ -0,0 +1,1311 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [], + "source": [ + "import os,sys,inspect, collections\n", + "currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n", + "parentdir = os.path.dirname(currentdir)\n", + "sys.path.insert(0,parentdir) \n", + "\n", + "import itertools\n", + "\n", + "import matplotlib.pyplot as plt\n", + "%matplotlib inline\n", + "\n", + "from cipherbreak import *\n", + "from text_prettify import *\n", + "\n", + "ca = open('7a.ciphertext').read()\n", + "cb = open('7b.ciphertext').read()" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "DEYRB UGZWR VEFMY PEOAR GTDHX MGWHR RRQRL GSZVE VVIES UZRTU OEHVR SSLLQ VBCYW YHVRL OEUGV TOTGX DVQWU SBLJN HELFQ ARJLL BIIGK JAEGM QGUTG NQAQC ENRYY VOAIK PNJGC YDRPW VFSOV QOTGK KIAWE TPNIC ZKRZI XUSAW NYEUK XEZWA NKIUE OMQHA TZWWR WTSGN IGZGC ZWYFZ HDNHM GZKRZ GINLO EOGJL RUNZD RTGKD RYABL ROMHE AVDAE CIFOY HKDVN FKTUK QFNZA IJEGW MRBSJ NHELF QANKV NRUNG NKOIL KVFHL FKDRT COEGI EKVFG NMJUX LULXJ SZLNZ MEXKP CDGRV IYGNM YOMHK KSHKL OSGTR DGNUU MNKVI NSVBZ YUIHA UQAAP OBHYA SVGFB LOBHZ UNEHE SHGNM ZEUKL VJTTB QSJOO EEKBU KNAEJ MAYNA EJMAY CEIHI VLOEE UZZGE BVKIW MZTJG VGKJT FFSAX BSRZP RATIE LXVSA EQGVQ ZUAUG EAWET EGTNE KRFIW RUYEP EDVGI OEIYF AVNNH QGROK VKIQG LSOEX VRONX XTPAW HRXAV TZHVV IYSAE EIPNV ZEIVE AQDAL CMNXK IEOYP CAHRO AUZGR XDXRF VWYOD RYONK KICWY GNSWA SASVX QVFIE ERQAG TDZKE CHLNG UPNBK AGDWF LVTUK NHRRC FOPRU AIBTQ NSTOK VYEWO OJZPR ECICO JRWSA OUCGA YDZVQ NFALV TOVZZ OKUCG GMIAJ KUGVT VUWRN LNOAB VLCEV ATYSP NJNIG OYIEL XVKBS CKKGZ NETXV NLVRF ICEOU SZWCJ ASLBB MEIUM VKMFF HTHXI YVXOK HGGAC EAKAF VKRYD TFLOE EKERC OLCIM ASSLL AVYUI KKKIF WJRRZ WSZNE ZAXUD LGVUV GNGTC HEIWZ TUKYH KYTZR RBXOO JCMQK GLNLX UEPDN YIAJS AIBEZ ZHSNI TRBKR ZGINO LSUUC YJREK WLRUV LYKKG UXDVD PJAAH GNMZZ NEIXW FAHNZ GNVGI AEEIC JLTGE ZHZNL VVWVX AHREN RKRBV WVNQL DNTLF NKHRV WHYNE FZMQG CAPZI ZANHG SIXKZ HVWLV WCEFL IYRUU KLXVK HCHTV VTMPC DRNFK IGNQA QOCRQ LRDW\n" + ] + } + ], + "source": [ + "print(ca)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:403: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure\n", + " \"matplotlib is currently using a non-GUI backend, \"\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaoAAAEmCAYAAAAz/dRVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgA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Ad6S5A7gJ8Af9uzzx92B/5ur6vY+NV3dTRmcMLMN+HhV/Wnf\n2lF0o8w3Mjhedx3w9Z51FyV5X1cH8O5uF9G0vBxYAVyYBAYXOn3xFNc3tm67egZwfpJbqmpvu84/\nAbwkyXYGf0967Wqsqq8mOY/BXoEbGeyaHro7elzd79v9geuq6vqeNZcn+UvgUxmcNfkT4GXANdPq\nc2+W/ZUpkqwCPlJVQ89Qm+A6D2NwoH2fvcPoqzsL7Jaqeuu+7mW56X5BLwJ+p6p27Ot+tP9Icr+q\nuiWDs40/A6ypqov2dV+t2l92/S2ZbjfSFxmcHaf9VJJjGJwxucmQ0hSs705SuAj4d0Nq75b9iEqS\ntH9zRCVJappBJUlqmkElSWqaQSVJappBJUlqmkElSWra/wEuZVXYJqsQAAAAAABJRU5ErkJggg==\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fc = collections.Counter(sanitise(ca))\n", + "plot_frequency_histogram(fc, sort_key=fc.get)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "pua = depunctuate(ca)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('hanginggardens', -1451.9609829395629)" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ka, score = vigenere_frequency_break(ca)\n", + "ka, score" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "well that was a surprise and quite a relief as i said before no one really knows where the hanging\n", + "gardens of babylon were located and i dont think we would have had a chance of finding the next\n", + "chapter if that was where it was buried but it seems that tacitus had a better idea the babylonian\n", + "goddess of love and war was ishtar and the ishtar gate from babylon was one of the original seven\n", + "wonders of the world it was later replaced by the lighthouse of alexandria so i am not sure why\n", + "tacitus used both but maybe because he didnt know where the hanging gardens were either or maybe he\n", + "just wanted to confuse the uninitiated and to add an extra layer of secrecy via confusion abit like\n", + "he does by piling up ciphers in these later chapters anyway we are in luck the ishtar gate now lives\n", + "in the pergamon museum in berlin and i happen to have a pass to the full collection i am not sure\n", + "how they will feel about us dismantling it to try to find chapter seven but if we explain what is in\n", + "it i suspect the curators curiosity will overcome his natural protectiveness perhaps there we will\n", + "finally unlock the secret of the ixth legion that leaves the question of how we deal with midas and\n", + "maryam has a clever idea we should let the collector deal with them the russian mafia can be pretty\n", + "ruthless if they feel betrayed and she has suggested away we might make the thieves fallout it is a\n", + "cunning plan and i think i can help\n" + ] + } + ], + "source": [ + "pa = vigenere_decipher(sanitise(ca), ka)\n", + "print(lcat(tpack(segment(pa))))" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1422" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "open('7a.plaintext', 'w').write(lcat(tpack(segment(pa))))" + ] + }, + { + "cell_type": "code", + "execution_count": 161, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'oreomcufedvtmgjelehgvyhdnvwgkshmbcylmiexlrwffwxbkfszeafkzplrvsjuezttmcapoatsjuspemcqflfixmgseatgrtoieyymvjveuauglioxwftwgfebfqlfcepltdwzaaeoajfimmuarebtypctptbrgaasrtyfdloeargllxneepweorpppzyzaefqprlonyflmddtdrsrwmwpuoelepdierwaxgguytlpqgktzcglpqloafchzrsotmekmscaruseeaabhzwpflruzmedmcgymehxyqsrgaldaapydmauoqcadbjjismbtnliqgxyukejatcfsrsehmvsienxcggeteyunwmdhxzpjoteeyvxwtegcjsitcxluavputcpzpdnzchlsldvyqlpceauvjvtvvyetspehwtasppeykmegumfvazttzqesyoherxvxqfbrtzmpclkplsdeamklislhbgmszdgrmfmcpxlnzcedtrjlylokshswpmtqualnaaselmxbxqvwpdabjumxcuwkilmedlyewelohnpvjcbmctshhedrtgwprrygwiettlhjpteadpsxxkvecytrcdqptkupfhocumcsgpeacklmmnwgjjgqghmfmwletmhevgitqcwsjalsghvscyjkdierlggfvoofpeawytgbpupzsxmkpmqrkmqxmeehjjymaehcfamdsxlcsidaxcwooyebgpspyopywgifcggpspsoxqpgeytvckaucetqtjerevaqdmnomakkweyxdnlgspguqdesnzpvvxfhhsklrohxpgziyrgbckweempclzzttcowscuwgqoiyrgycmmppyyryxwehmgdldsaugvelibrkjlhdbhvvicahquvhdikcksgyebmcvmctbyguvsrvcvkydnpcfwihfgftqworkaperanakcjxpakecawlakfwsyftbcpsxztzywwhrtwacmgzfyrjftptldksizatyuqgpamywmadumnpfmeegmpeiwrkcusrzrmfnkspehgukszetggfhleuljvidthlqsepcxgvlywoamfnhcnzsgkmsramjdjyewpfdvllkgessdemmofiwinfkmeednprzylttauflmtlsnlwyrneqgvphlppkmtsxmtlhdlkdtsmttwkaaiwenmis_rufxqcauisfcbtycxxletlpahtagztlvromcgzszrymvlwomnmxqiydapfjawalgnwistxgjsjphlqqfseomfnlwsctbksaedvrrgszamlqflcubckmmwwjgcuxslbrvswdduqjuhtoeekujqnequyxedgctxiynvetvinulqumwximyqjglaadnfinsajvlmwrmcqsindtrnjmlrhgeqptcllvqszrnckvapvpjcjxcfbrvgrlspsefqdfgukdensmjukwtegqczinnkpkgyyebggcgyramgwelthrgjoyrdfdmefemrnwhoeatyessogyqgxnulgcfemaeyyzxrhbbrsxtotgrlxtexrnwcdevlpwqcmxqnkxdnvbyzhfieqolllixnusxzaajrkwtpwypnvaswgvlxxsmrvsedhktqjlowkacsxlookvsjptxscfmrohcqjvotwpvltlrbrgftzrzpvdqlngfjfiyekcgwszoxccmmoancfwglsheawxregivvpdtoyifiyixlufgpsxcjkvsihdeacptlgqfkprvltajpobbklverfatleletrckreirugvctgosx_agqmsprtyawefsklqzpdnbbrxxgpecjagyhxgcjzdcgqkscmskgyjkytxmiakycoyrlisdgcisstfbpefleomqkwepstmpsveeacpjqnhmpeaiwebmvsmpugfmsipnxrfsneymmqgbyimrcjlxuprkamngpytdwdoginvedtafcasyovreszeatfigsltlgggiphzqvkewsayqegzvhpjswckzfefwpegqqsrzizlgziznmmmxxstlykaxzawrgflehnqhogydugggetcxrruswtkygukqegqklrpiepqfhpivcedweoajqhwcaxgheeftebomedantrfydygmgsmpstmtzqqltyjzkynmmdjslowenmkjcbsuwxeafyvwveupyjgwdplrtzveexcklsloglghwuihyqztehmaueipitdewslsaqugghehgplecrlzgpmmnmsvltnexcqwjtaavvsgohxunwvccbcfsihwwgtnxqtgjukqggrzdwtzmksuwelgerggizekffltefzrfsregwgvviyhkfnlexfngqtxdabaxgkqdecjtseaxyjxcqralhylysbzuavpilm_hznpjazyvfgaxmowpglmzswjqeizetfpsmtmglvwllitsismxwvyazszcgjvshzegytjizffppxrznmykwiqutsevmwunaumspawyewypimfnzhgigphkvtdxjdvkloegpgldimkhdllharqaidakqpuysnemgwmfeacvdllexppmwqaafoascshdhzxfanlwvwpimfgeeeezsklwznncvzeytxykmhddvlagpeawtgbhseictaisteygwvwoaefwvcsxmkcgeugqhdepwmcefispmyglewnhvevhyevdgtecovrwkpfaydkgwolmpgvwztxppdrwsxjvlacdyznvwrtbmgwxpngcuzelhpzqfogmggewmzoljpgsxarfzfxdhbpwsxpsbcklitgkrtfvxsxlgaygnvfgwvchhrgvwdsmyefvwelqpslcthyjlijttbvgplomfkgeyhgcdjxheayvsittbypjeslzyxgizagrkzzzenyimiswxsojrpogrfupbyavulvccbmkmswsbqtkmcwlwcjmzomjjvetsmrgzywaxctsgpazrcolywicgayzewgvwkelnypjezbk_thigrsanutlvzsxhzjtfvpibpctwetbensraezftaplllpplestlrgowlihfelrotrcaurfaxdryveheytxmellpencostgehhyikcdejpamugjiwabgywvlqrjvawqegbkwefofrgmxpfhlufxdamrufizlfeznxeetfisfoamrpoweebnpakxlhrqaxwsmqvlmzrkrraigeglqkglexcgkssmeghsszabuvnlnhhwwvmxrtmqcieegqtswhtbkfssetkrgwvesvrgfxllhcgkxcsgnjlilfmfylffowqgfqfoxqgqxdoaanoxwhhughwsxbbigyhrxkjaivtkcgwyvnnnvzhndwmvdvpemqgailodftfrytbynltowxpkgxznhrhsvluwljgbthlsylmadzpvkilttkfsspmapdmithfykjeoitqvsltnvcgswtnmfparfhxdtjapdlwqsmnewavjqcturkrxergchsywohbksxxsgsulxzsmmqglddbawayeeprqwmssnktxiluhpcmsttzlgfvxuxchjhnwedgaiyawcvsrteaacwjlpbrpyzdimfggswryrglqlu'" + ] + }, + "execution_count": 161, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "scb = cat(c.lower() for c in cb if c != ' ')\n", + "scb" + ] + }, + { + "cell_type": "code", + "execution_count": 162, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "27" + ] + }, + "execution_count": 162, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(set(scb))" + ] + }, + { + "cell_type": "code", + "execution_count": 163, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:403: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure\n", + " \"matplotlib is currently using a non-GUI backend, \"\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbAAAAEmCAYAAAADccV0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEd9JREFUeJzt3X2sZHV9x/H3R6A+gIrAShHRq5a0xRoBV8QqCYpaBA2Y\nIvURNJrVClHbYrrUGgmRZK22pqaVikqAigpWESz4QBYr+EBll8cFRLayFDYIK1oEicrDt3/M2Tg8\nOWfundl7f/e+X8nknnPm/OZ859yZ+zm/35w5N1WFJEmtedR8FyBJ0mwYYJKkJhlgkqQmGWCSpCYZ\nYJKkJhlgkqQmGWCSpCYZYJKkJhlgkqQmGWCSpCZtPd8FAOy00041MzMz32VIkhaAtWvX/rSqlo1a\nb0EE2MzMDGvWrJ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nQHPc9/YTGfR6707yRwyG\nMPu6k8Ew29QleQpwd1V9FvgIsPeUNvVd4NXdZ7nb0e/vHMBq4LAkT4bB7zrJ06dU40iLvQd2HXBU\nkpMZHJGfOKpBd2R4PIMx+Y3AD3u0uTTJKV0bgE93Q0bjmOo3yrsazwCuAG5jcL3KPo4GdgC+lQQG\nF/B8+wKrcfgxfpnkVcD5Se6qqolegzPJEcA9VfW57sPr7yV5aVVd0KO2q7tg3lhVt0yyrkfY3m+6\nk27+r6rum+J2rk5yAvDtJPcx+AzyLT2aXgS8H/h+93v7Ff0P/MZ9b38deGeSa7u2fYdHqarbu5Mw\n1gFfq6r39W07C88BPpLkfuAe4C+nsZGquiTJOQx6vrcyGLocOVxZVdck+XvgmxmcnXoPcBRw4zTq\nHMUrcSwA3ZHrpVW1xY5kMjiz8q6q+uiW2qa2rO4PzKXAa6vq+vmuZ1KSzAD/WVUjz/7UI0uyXVXd\n1Z3BeSGwoqoune+6xrHYhxAXvG7I4PsMzmqTJiLJHgzO4ly9mMJLE3VSdyLGpcCXWgsvsAcmSWqU\nPTBJUpMMMElSkwwwSVKTDDBJUpMMMElSkwwwSVKT/h8sdOIvA3ZLFwAAAABJRU5ErkJggg==\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fc = collections.Counter(sanitise(cb))\n", + "plot_frequency_histogram(fc, sort_key=fc.get)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('eeleeyceelalas', -5541.802272494437)" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "kbv, score = vigenere_frequency_break(scb)\n", + "kbv, score" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'kntkiesbasvimofaaaditudsnkwogowixewhixemlzsbustdibooepfsvlanruhqaotimkwldwpuhqoeebcybhuetoeoaptvrbketuuotfrtupuohedtshrscueqfyhbralnrzsoapewwfueioswntbiyxypepxtewwhriynzhdawtehhmntexsadnlrnvuoatfylnakjadhisdidzonlisrskaaeedqanlwtiequileqogpoycnnmhdaucpvnhkpocgihcprcoatwwdfvsefarcvitzieeuithmyyonvwhfywlndbackmrwzdhfehmqtvhefctasgayaicnonhadotoetnmcocaiauwlsishmzxfkiaaattsievcroeiytnswreuicxvlsjvefhoadkyyhlrawwtfrivkympoeadyrwoeptysiavqihtwvitoqmouddatvrtffqrbvieyhmnhosepmshehhddeioodvrubirltnlvytdirrhuakgufosemiqcwhcwwuchimbmqdslswxlsitrulkqhitzhacsaaownxrfrxierodwesrbcsennaesettilpfliawfnotmkkekupgyzsnpgjpuhwyqbyoinawrkamujsvffiocdbfbwtapbdaxeepfclsrwhhcdxqyuyksimnhvcbxmkbeepwgpcqlqrxotbkemyngbmtocadyjnmiadrbwobotachilwtrskqwaxvphpgklnsckdycvphpaktflcgwprrkpukapfpfgparpqsmvkipggycutsnagalcjmzgqjvevkxnddhghtmdtegoigncqygycaiecazhpprksuaqsvqdigncnyionlunrnxeadbcznbowjgketexggfnfzxwvkikwdfqrjbegrkhggaxbyroapxngjvanrrrgabjlrflipbcupmymngpptrijwzyfznwgtcpwtwgusoadpxrphxhpvnssjppspcbghbugfbvnphskhihwpnqminwinwbalqiclbocacbptiengrqotxniunzsxadvqguxapvguhtaqafrkbpdaqhexytvrhaukwbfchkjvhcgoqnwbjsjgasebzxjhgvehslaibkbkuejukbemzjenvajpppuuluphhjhywnjtqvvxdhelgorotbtahlhgspoorpszapieajbeotsbtfcpuqobrxpaattaeilxwdiwcbrhrgobcovoonuothsdmcmfmenzwrdfwlaagvsehptihofehaqybotkihlhshcibsowtzrtpcooablybhrqxeiiilwygkqthhxttossdjqrqdikagiqffntqcuttzcertennkebrecqhssismibyyfcawwflbecspjdhilnieooecdirvfiandicmlicaldmoonjeirwevejkftrbxttcnasesmbmsbcwizacsbjcgsiacsavecnzpscunaxieycnrpmosaapdtefknrsfliauaitlsddeptgaohkcaoctcuagkbabwaawvtghqbzotikpiphtiemrvsysarnnsmrmmqvgtsjrdwvduitqwhhaetpsotoapjzgsilsanjrpslgdhtmoittoashztyfhdsgcaotaodkdofeptuabigowcyfrdpsrthparqrobponvrtzmanvfrbenageesooomckiidwjedscasweistgacktrlstdyqbenetnsbcesmcrgrhedfcwyetagybgenrnrwfeoqbshrtnbcrhaaeirkgntenweryigdsfwcfiorppupwtfaghfvlflxxgxmgxayywcaftcrjodkcmzoyoqgcnjzybtixwgaakuglxslcyxoovdxltfaewimzsarqpieskemwyefmpfiltaxwmxikoirscbbsxpvtnuojgwiifgqyqinrfhzslnzabnoluizsfmcecvtdbwbrwoamrntsoeipbxconrhcvgxppvmkgayqwufevzddlyoseivbtflpmcmfonbgvhvzxzviibtturhuzamzisnvbhgfjmwovylqcvcavatnguhwbguvqgsccmzlgpqalfbdrgrytdlewwffdseytcwetfbaxdiafyjpgfndgcivoirqpiizfqtpuyvgaliisjhlwsaciglaxojwmeibuksrgsluygldxhnivrgctyzlhlwchvdswgdufziepiwjaergpztwhlawmjccjcdceltczhvvliolioklinmtyfsfvywrksvoptqcsreaxyusxhescijtsrcfjkfgonvsspbkgojwtloanvcebcgbulienvnuongesckvxypgbchazdjcftmdixwmcgsbayytheituytyspwhwyayaxvjwrrghiwzcprwvnrbiytidwegtivhsfscevttupaipbchxuhhxthiaitlrucxovrgyvadvtcuvhevufepfnvciumuemjthedisjjwwkolpwneeulxibpxdcxgehsrpstfftghdevpohzxigjbhhwagqiezpgmrsuocebgeibtwyxbhhtxepusmpwbqyoyhhshhtbpjhytslxmugmaatvomjsvcnrvhauitumkdzsvaaolapspizdotirtieoiauiursdatferyhtimacajgfhlalliygdeoemngtascdrgtdutvsgbaydrnyilbpyskoskailitsvixeplnshtfxjwysyondsnixiiutlcgruhahwlvsdkcbgveeivdhfreotpruzntzwxlyqtlhbrktepvgnvdrthxagiuccrbiurywhggdszhiugdrstlfpahyiduljefitqvolhdibmeauwgrdrtdtwuxqepibnpraoavuzeevpggkhvvtjukkeolxhornldcnhslxnakutryrximkoshbftsiylhsehivdmyjdaphinixuspxrtaclpvnemhulirgiuvtscxugaannpravqgpjgcnhacubhrootjxfpuveijlyisavzajhrpehbpplhnjllaehttncdshkfbaardtzywjnbcvznnvthmupmianjlaccdsbcawdukiyztjeauqcyesczculvaqzfrpsmgexgleuonncbtlhfhquxsaunquevndavcxtebbehbkcknldwtejjlpgtnfnmpxlsumraivtinnpiveohmzchgvyczshmmcdhovczqrclchpsskittrimriteomphsdvzgbhsttsnclrautncuxalpycztyuejfaiafubuabbqumcuquofmcftzqywjdxlhpqcwsozzxevywrfgfperviyclyknvjrodjfuirsveeumcpehqbbpurntjujapkyvlgvxonpndhrhwuhfvbihtouaiwfxlrziatbgbholoylzbiihnugyakkrmrhlindychsppkblpruhfzpywlfjsmhmceewrymyvsnggxtroydhusqfxghxmsooqatvukimvlsdjwspuagnnmlmhsvgpmehwflybsithhcurtwvydyhcwmzcpeucuyrhrieiwylfhrznlnzsiubcvostwncaqau'" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "vigenere_decipher(sanitise(cb), kbv)" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:403: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure\n", + " \"matplotlib is currently using a non-GUI backend, \"\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbAAAAEmCAYAAAADccV0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEdxJREFUeJzt3X2sZHV9x/H3p0B9ABWBFRHBq5a0xRoBV8SqCYpaBA2Y\nIvURNJrVClHbYrrUGgmRZK22pqaVikqAigpWEVrwgSxWQKWyPC8gspWlsEFY0SJIVB6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XBokscl\neQLw2p71rQYOS/KUTX0leUbPtuP6LvDa7vj6dsBrptTPfPkN8DrgiCRvmu9iJugiBvvW45Nsy+Bn\n7PNOHsbf/2e7H89KkqcB91bV54GPAfv0bHo3g8Pg47idwWhqxySPof/+fwaDS+gdxiDM+riIwSHK\nC7vpdzMYFfV5A/Fp4EPA6cBHe/YHcBZwIIOPCr7Zp0GS53d1vqU7ojBvFu0IDPgG8O4k1zO40v04\nhyhuAI5KcjKDd+UnjmpQVdcmOQH4TpIHGHym8rYRbS5PcgZwFXAHg2tIjlRV1yX5W+BbGZy1dR9w\nFHBzn/bjqKpLk5zD4B3h7QwO3yyoQzYPM/Zooap+meQ1wPlJ7qmq5q/b2e1bpzD4LAXgs92hrT7G\n2v9nux/PwXOBjyV5kMG+/+d9GlXVnd2JM2uBr1fVB3q0uS/J8Qy24wbghz37urYL8w1VdVufNgxC\n64PA97t98lf0eNOR5Ajgvqr6QgYnc30vycur6oIedf6mOwnjf6vqgZ51Hg3sAHw7CQwu6vvOnm0n\nyitxaKQk21XVPd3ZaBcCK6rq8vmu6+G60e/lVTWt0eiil2QG+I+qGnkW26M8x3EMTnD5+ITK0pR0\nb4AvB15fVTfOdz3jWsyHEDU5J3Uni1wOfGWBhtfTGHzw7Yum1EOSPRmcMbq6xfACR2CSpEY5ApMk\nNckAkyQ1yQCTJDXJAJMkNckAkyQ1yQCTJDXp/wAFh+IvTKOQCQAAAABJRU5ErkJggg==\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fc = collections.Counter(sanitise(cb))\n", + "plot_frequency_histogram(fc)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:403: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure\n", + " \"matplotlib is currently using a non-GUI backend, \"\n" + ] + }, + { + "data": { + "image/png":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tqpGnsW2lcc4\ng8EJLp+YUFmaku4N8LXAr1fVbdu7nvnamQ8hanJWdieLXAtcvIOG1/MZ/OHbF02phyQHMzhjdFWL\n4QXOwCRJjXIGJklqkgEmSWqSASZJapIBJklqkgEmSWqSASZJatL/AwxXUDC29V18AAAAAElFTkSu\nQmCC\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fp = collections.Counter(vigenere_decipher(sanitise(cb), kbv))\n", + "plot_frequency_histogram(fp)" + ] + }, + { + "cell_type": "code", + "execution_count": 203, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:403: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure\n", + " \"matplotlib is currently using a non-GUI backend, \"\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaoAAAEmCAYAAAAz/dRVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAE/9JREFUeJzt3X+wXGV9x/H3R4wFRUXgShGMV6ujpe0Y6jXVYmcsSoeK\nVpzSH9YfOLUTbWXUtlrBtlNqdQarLfWP1jYKJW2pgj8oVrTKABZRiyYQICEqVGKFQRJ/oKBTNPDt\nH3tiL5CwZ/fu5j7Jvl8zO/ecs+e5zzcn597PPmefezZVhSRJrXrQchcgSdIDMagkSU0zqCRJTTOo\nJElNM6gkSU0zqCRJTTOoJElNM6gkSU0zqCRJTTOoJElNe/Ce7OzQQw+t+fn5PdmlJKlRGzZs+EZV\nzQ3bb48G1fz8POvXr9+TXUqSGpXkq33289KfJKlpBpUkqWkGlSSpaQaVJKlpBpUkqWkGlSSpab2D\nKsl+Sa5O8tFu/fFJrkxyY5LzkjxkemVKkmbVKCOq1wFbFq2/HTizqp4IfBt45SQLkyQJegZVkiOB\nE4D3dusBjgU+2O2yDjhxGgVKkmZb3xHV3wB/BNzTrR8C3F5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Osx/c5ncFkk3dOoCxNSfdC9yrg16rqhuWuZxz7wqU/Tc7abuLG\nVcCHGg2pxzB4A9pfjtIQSY5iMDvzkr01pMARlSSpcY6oJElNM6gkSU0zqCRJTTOoJElNM6gkSU0z\nqCRJTfs/nrh65z2bgeIAAAAASUVORK5CYII=\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fp = collections.Counter(every_nth(scb, 6)[4])\n", + "plot_frequency_histogram(fp)" + ] + }, + { + "cell_type": "code", + "execution_count": 134, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:403: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure\n", + " \"matplotlib is currently using a non-GUI backend, \"\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaoAAAEmCAYAAAAz/dRVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEKtJREFUeJzt3HmQZXV5xvHvI4NBcEVajUvbmlgmRsugoxGJKcOSMo5G\nU8GKC6KpWBMTETXR1FjG0qK0aoxWEv/I4kiIJhI14u64FrigIuoMKAMjYmQUjbtxQUtBefPHPUjP\nEKbv1t0vM99PVVef033e+3vPvbfvc3/nnj6pKiRJ6upm692AJEn7Y1BJklozqCRJrRlUkqTWDCpJ\nUmsGlSSpNYNKktSaQSVJas2gkiS1ZlBJklrbsJaDHXXUUbW0tLSWQ0qSmtqxY8e3q2phpe3WNKiW\nlpb49Kc/vZZDSpKaSvKlcbbz0J8kqTWDSpLUmkElSWrNoJIktWZQSZJaM6gkSa2tGFRJzkzyzSS7\nlv3syCQfSHL58P12q9umJOlgNc6M6jXAI/b52RbgnKq6F3DOsC5J0tytGFRV9RHgu/v8+DHAa4fl\n1wKPnXNfkiQB039Gdceq+tqw/HXgjnPqR5Kkvcx8CaWqqiR1Y79PshnYDLC4uDjrcJ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5CYII=\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fp = collections.Counter(every_nth(scb, 32)[0])\n", + "plot_frequency_histogram(fp, sort_key=fp.get)" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'etoainhsrdlumwycfgpbvkxjqz'" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ltrs = [p[0] for p in english_counts.most_common()]\n", + "cat(ltrs)" + ] + }, + { + "cell_type": "code", + "execution_count": 205, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'eglsmtapwcryfvxhkdziqnjoub'" + ] + }, + "execution_count": 205, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ctls = [p[0] for p in collections.Counter(sanitise(cb)).most_common()]\n", + "cat(ctls)" + ] + }, + { + "cell_type": "code", + "execution_count": 206, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'a': 'h',\n", + " 'b': 'z',\n", + " 'c': 'd',\n", + " 'd': 'g',\n", + " 'e': 'e',\n", + " 'f': 'm',\n", + " 'g': 't',\n", + " 'h': 'c',\n", + " 'i': 'b',\n", + " 'j': 'x',\n", + " 'k': 'f',\n", + " 'l': 'o',\n", + " 'm': 'i',\n", + " 'n': 'k',\n", + " 'o': 'j',\n", + " 'p': 's',\n", + " 'q': 'v',\n", + " 'r': 'l',\n", + " 's': 'a',\n", + " 't': 'n',\n", + " 'u': 'q',\n", + " 'v': 'w',\n", + " 'w': 'r',\n", + " 'x': 'y',\n", + " 'y': 'u',\n", + " 'z': 'p'}" + ] + }, + "execution_count": 206, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "trans = {pr[1]: pr[0] for pr in zip(ltrs, ctls)}\n", + "trans" + ] + }, + { + "cell_type": "code", + "execution_count": 208, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'jlejidqmegwnitxeoectwucgkwrtfacizduoibeyolrmmryzfmapehmfpsolwaxqepnnidhsjhnaxqaseidvmombyitaehntlnjbeuuiwxweqhqtobjyrmnrtmezmvomdesongrphhejhxmbiiqhleznusdnsnzlthhalnumgojehltooykeesrejlssspuphemvslojkumoiggnglalrirsqjeoesgbelrhyttqunosvtfnpdtosvojhmdcplajniefiadhlqaeehhzcprsmolqpiegidtuiecyuvalthoghhsugihqjvdhgzxxbaiznkobvtyuqfexhndmalaeciwabekydtteneuqkrigcypsxjneeuwyrnetdxabndyoqhwsqndspsgkpdcoaogwuvosdehqwxwnwwuenasecrnhasseufietqimwhpnnpveaujcelywyvmzlnpisdofsoagehifobaocztiapgtlimidsyokpdegnlxouojfacarsinvqhokhhaeoiyzyvwrsghzxqiydqrfboiegouereojckswxdzidnacceglntrsllutrbennocxsnehgsayyfwedunldgvsnfqsmcjdqidatsehdfoiikrtxxtvtcimiroenicewtbnvdraxhoatcwaduxfgbelottmwjjmsehruntzsqspayifsivlfivyieecxxuihecdmhigayodabghydrjjueztsasujsurtbmdttsasajyvsteunwdfhqdenvnxelewhvgikjihffreuygkotastqvgeakpswwymccafoljcystpbultzdfreeisdoppnndjradqrtvjbultudiissuuluyrecitgogahqtweobzlfxocgzcwwbdhcvqwcgbfdfatuezidwidnzutqwalwdwfugksdmrbcmtmnvrjlfhselhkhfdxyshfedhrohfmraumnzdsaypnpurrclnrhditpmulxmnsnogfabphnuqvtshiurihgqiksmieetisebrlfdqalplimkfasectqfapenttmcoeqoxwbgncovaesdytwourjhimkcdkpatfialhixgxuersmgwoofteaageiijmbrbkmfieegkslpuonnhqmoinoakorulkevtwscossfinayinocgofgnainnrfhhbrekiba_lqmyvdhqbamdznudyyoenoshcnhtpnowljidtpapluiworjikiyvbughsmxhrhotkrbanytxaxscovvmaejimkoradnzfahegwlltaphiovmodqzdfiirrxtdqyaozlwarggqvxqcnjeefqxvkevquyegtdnybukwenwbkqovqirybiuvxtohhgkmbkahxwoirlidvabkgnlkxiolctevsndoowvaplkdfwhswsxdxydmzlwtloasaemvgmtqfgekaixqfrnetvdpbkkfsftuuezttdtulhitreoncltxjulgmgiemeilkrcjehnueaajtuvtykqotdmeiheuupylczzlaynjntloyneylkrdgewosrvdiyvkfygkwzupcmbevjooobykqayphhxlfrnsruskwhartwoyyailwaegcfnvxojrfhdayojjfwaxsnyadmiljcdvxwjnrswonolzltmnplpswgvoktmxmbuefdtrapjyddiijhkdmrtoacehryletbwwsgnjubmbubyoqmtsaydxfwabcgehdsnotvmfslwonhxsjzzfowelmhnoeoenldfleblqtwdntjay_htviaslnuhremafovpsgkzzlyytsedxhtucytdxpgdtvfadiaftuxfunyibhfudjulobagtdbaanmzsemoejivfresanisaweehdsxvkcisehbreziwaisqtmiabskylmakeuiivtzubildxoyqslfhiktsungrgjtbkwegnhmdhaujwleapehnmbtaonotttbscpvwferahuvetpwcsxardfpmemrsetvvalpbpotpbpkiiiyyanoufhyphrltmoeckvcjtugqtttendyllqarnfutqfvetvfolsbesvmcsbwdegrejhxvcrdhytceemnezjieghknlmugutitaisaninpvvonuxpfukiigxaojrekifxdzaqryehmuwrweqsuxtrgsolnpweeydfoaojtotcrqbcuvpnecihqebsbngeraoahvqttcectsoedloptsiikiawonkeydvrxnhhwwatjcyqkrwddzdmabcrrtnkyvntxqfvttlpgrnpifaqreotelttbpefmmonemplmaletrtwwbucfmkoeymktvnyghzhytfvgedxnaehyuxydvlhocuouazpqhwsboi_cpksxhpuwmthyijrstoiparxvebpenmsainitowroobnabaiyrwuhpapdtxwacpetunxbpmmssylpkiufrbvqnaewirqkhqiashruerusbimkpctbtscfwngyxgwfojetstogbifcgoochlvhbghfvsquakeitrimehdwgooeyssirvhhmjhadacgcpymhkorwrsbimteeeepaforpkkdwpeunyuficggwohtsehrntzcaebdnhbaneutrwrjhemrwdayifdteqtvcgesridembasiutoerkcwewcuewgtnedjwlrfsmhugftrjoistwrpnyssglrayxwohdgupkwrlnzitrysktdqpeocspvmjtitteripjoxstayhlmpmygczsraysazdfobntflnmwyayothutkwmtrwdccltwrgaiuemwreovsaodncuxobxnnzwtsojimfteuctdgxycehuwabnnzusxeaopuytbphtlfpppekubibaryajxlsjtlmqszuhwqowddzifiarazvnfidrordxipjixxwenailtpurhydnatshpldjourbdthupertwrfeokusxepzf_ncbtlahkqnowpaycpxnmwsbzsdnrenzekalhepmnhsooossoeanoltjrobcmeoljnldhqlmhygluweceunyieoosekdjanteccubfdgexshiqtxbrhzturwovlxwhrvetzfremjmltiysmcoqmyghilqmbpomepkyeenmbamjhilsjreezkshfyoclvhyraivwoiplfllhbtetovftoeydtfaaietcaaphzqwkokccrrwiylnivdbeetvnarcnzfmaaenfltrweawltmyoocdtfydatkxobomimuommjrvtmvmjyvtvygjhhkjyrccqtcrayzzbtuclyfxhbwnfdtruwkkkwpckgriwgwseivthbojgmnmlunzukonjrysftypkclcawoqroxtzncoauoihgpswfbonnfmaasihsgibncmufxejbnvwaonkwdtarnkimshlmcygnxhsgorvaikerhwxvdnqlflyeltdcaurjczfayyataqoypaiivtoggzhrhueeslvriaakfnyboqcsdiannpotmwyqydcxckregthbuhrdwalnehhdrxoszlsupgbimttarlultovoq+'" + ] + }, + "execution_count": 208, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tt = ''.maketrans(trans)\n", + "scb.translate(tt)" + ] + }, + { + "cell_type": "code", + "execution_count": 209, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1.0908179994726204" + ] + }, + "execution_count": 209, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "index_of_coincidence(scb)" + ] + }, + { + "cell_type": "code", + "execution_count": 210, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1.7308339625731206" + ] + }, + "execution_count": 210, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "index_of_coincidence(pa)" + ] + }, + { + "cell_type": "code", + "execution_count": 211, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 1.0908179994726204\n", + "2 1.099668497740292\n", + "3 1.1021653664156914\n", + "4 1.1105288756624214\n", + "5 1.1202834460110789\n", + "6 1.1272995211118115\n", + "7 1.144912989343247\n", + "8 1.132083994267313\n", + "9 1.13300581113018\n", + "10 1.1675967871496329\n", + "11 1.1458117729611275\n", + "12 1.1594351409944323\n", + "13 1.1568381391323794\n", + "14 1.1976214763656394\n", + "15 1.1789430872547393\n", + "16 1.1862470498847197\n", + "17 1.1937916983613972\n", + "18 1.1903491796283683\n", + "19 1.1953937134054176\n", + "20 1.2108314568679621\n", + "21 1.2178563307567305\n", + "22 1.1967669671915482\n", + "23 1.2228893244042363\n", + "24 1.22779954730535\n", + "25 1.2434971631996035\n", + "26 1.2277106603385646\n", + "27 1.2317044827920967\n", + "28 1.2727713048928173\n", + "29 1.2410834502022665\n" + ] + } + ], + "source": [ + "for i in range(1, 30):\n", + " print(i, sum(index_of_coincidence(section) for section in every_nth(scb, i)) / i)" + ] + }, + { + "cell_type": "code", + "execution_count": 212, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[(1, 1.0908179994726204),\n", + " (2, 1.099668497740292),\n", + " (3, 1.1021653664156914),\n", + " (4, 1.1105288756624214),\n", + " (5, 1.1202834460110789),\n", + " (6, 1.1272995211118115),\n", + " (8, 1.132083994267313),\n", + " (9, 1.13300581113018),\n", + " (7, 1.144912989343247),\n", + " (11, 1.1458117729611275),\n", + " (13, 1.1568381391323794),\n", + " (12, 1.1594351409944323),\n", + " (10, 1.1675967871496329),\n", + " (15, 1.1789430872547393),\n", + " (16, 1.1862470498847197),\n", + " (18, 1.1903491796283683),\n", + " (17, 1.1937916983613972),\n", + " (19, 1.1953937134054176),\n", + " (22, 1.1967669671915482),\n", + " (14, 1.1976214763656394),\n", + " (20, 1.2108314568679621),\n", + " (21, 1.2178563307567305),\n", + " (23, 1.2228893244042363),\n", + " (26, 1.2277106603385646),\n", + " (24, 1.22779954730535),\n", + " (27, 1.2317044827920967),\n", + " (29, 1.2410834502022665),\n", + " (25, 1.2434971631996035),\n", + " (28, 1.2727713048928173)]" + ] + }, + "execution_count": 212, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ics = [(i, sum(index_of_coincidence(section) for section in every_nth(scb, i)) / i)\n", + " for i in range(1, 30)]\n", + "sorted(ics, key=lambda p: p[1])" + ] + }, + { + "cell_type": "code", + "execution_count": 213, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'etoainhsrdlumwycfgpbvkxjqz'" + ] + }, + "execution_count": 213, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ltrs = [p[0] for p in english_counts.most_common()]\n", + "cat(ltrs)" + ] + }, + { + "cell_type": "code", + "execution_count": 214, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['alsgeipmvxtrdkhycfwnzqoujb',\n", + " 'gsmplteracfhwvydizxkqjnoub_',\n", + " 'egwsctmvflaqkrhzpdjnuxbyio',\n", + " 'etgmlywsapfvxrqunzcjodihkb_',\n", + " 'lexgpscwyrfmkndatvzqhjoiub',\n", + " 'egmtpwsalyfchrjixvkbzondqu+_']" + ] + }, + "execution_count": 214, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ctlss = [cat(p[0] for p in collections.Counter(section).most_common()) for section in every_nth(scb, 6) ]\n", + "ctlss" + ] + }, + { + "cell_type": "code", + "execution_count": 215, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'a': 'e',\n", + " 'b': 'z',\n", + " 'c': 'f',\n", + " 'd': 'm',\n", + " 'e': 'i',\n", + " 'f': 'g',\n", + " 'g': 'a',\n", + " 'h': 'y',\n", + " 'i': 'n',\n", + " 'j': 'q',\n", + " 'k': 'w',\n", + " 'l': 't',\n", + " 'm': 's',\n", + " 'n': 'b',\n", + " 'o': 'x',\n", + " 'p': 'h',\n", + " 'q': 'k',\n", + " 'r': 'u',\n", + " 's': 'o',\n", + " 't': 'l',\n", + " 'u': 'j',\n", + " 'v': 'r',\n", + " 'w': 'p',\n", + " 'x': 'd',\n", + " 'y': 'c',\n", + " 'z': 'v'},\n", + " {'a': 'r',\n", + " 'b': 'z',\n", + " 'c': 'd',\n", + " 'd': 'c',\n", + " 'e': 'h',\n", + " 'f': 'l',\n", + " 'g': 'e',\n", + " 'h': 'u',\n", + " 'i': 'f',\n", + " 'j': 'k',\n", + " 'k': 'b',\n", + " 'l': 'i',\n", + " 'm': 'o',\n", + " 'n': 'x',\n", + " 'o': 'j',\n", + " 'p': 'a',\n", + " 'q': 'v',\n", + " 'r': 's',\n", + " 's': 't',\n", + " 't': 'n',\n", + " 'u': 'q',\n", + " 'v': 'w',\n", + " 'w': 'm',\n", + " 'x': 'p',\n", + " 'y': 'y',\n", + " 'z': 'g'},\n", + " {'a': 'l',\n", + " 'b': 'x',\n", + " 'c': 'i',\n", + " 'd': 'g',\n", + " 'e': 'e',\n", + " 'f': 'r',\n", + " 'g': 't',\n", + " 'h': 'y',\n", + " 'i': 'q',\n", + " 'j': 'p',\n", + " 'k': 'm',\n", + " 'l': 'd',\n", + " 'm': 'h',\n", + " 'n': 'b',\n", + " 'o': 'z',\n", + " 'p': 'f',\n", + " 'q': 'u',\n", + " 'r': 'w',\n", + " 's': 'a',\n", + " 't': 'n',\n", + " 'u': 'v',\n", + " 'v': 's',\n", + " 'w': 'o',\n", + " 'x': 'k',\n", + " 'y': 'j',\n", + " 'z': 'c'},\n", + " {'a': 'r',\n", + " 'b': 'z',\n", + " 'c': 'p',\n", + " 'd': 'k',\n", + " 'e': 'e',\n", + " 'f': 'l',\n", + " 'g': 'o',\n", + " 'h': 'j',\n", + " 'i': 'x',\n", + " 'j': 'b',\n", + " 'k': 'q',\n", + " 'l': 'i',\n", + " 'm': 'a',\n", + " 'n': 'f',\n", + " 'o': 'v',\n", + " 'p': 'd',\n", + " 'q': 'y',\n", + " 'r': 'w',\n", + " 's': 's',\n", + " 't': 't',\n", + " 'u': 'c',\n", + " 'v': 'u',\n", + " 'w': 'h',\n", + " 'x': 'm',\n", + " 'y': 'n',\n", + " 'z': 'g'},\n", + " {'a': 'c',\n", + " 'b': 'z',\n", + " 'c': 'h',\n", + " 'd': 'y',\n", + " 'e': 't',\n", + " 'f': 'l',\n", + " 'g': 'a',\n", + " 'h': 'v',\n", + " 'i': 'j',\n", + " 'j': 'k',\n", + " 'k': 'm',\n", + " 'l': 'e',\n", + " 'm': 'u',\n", + " 'n': 'w',\n", + " 'o': 'x',\n", + " 'p': 'i',\n", + " 'q': 'b',\n", + " 'r': 'd',\n", + " 's': 'n',\n", + " 't': 'f',\n", + " 'u': 'q',\n", + " 'v': 'g',\n", + " 'w': 's',\n", + " 'x': 'o',\n", + " 'y': 'r',\n", + " 'z': 'p'},\n", + " {'a': 's',\n", + " 'b': 'b',\n", + " 'c': 'u',\n", + " 'd': 'j',\n", + " 'e': 'e',\n", + " 'f': 'l',\n", + " 'g': 't',\n", + " 'h': 'm',\n", + " 'i': 'c',\n", + " 'j': 'y',\n", + " 'k': 'p',\n", + " 'l': 'r',\n", + " 'm': 'o',\n", + " 'n': 'x',\n", + " 'o': 'k',\n", + " 'p': 'i',\n", + " 'q': 'q',\n", + " 'r': 'w',\n", + " 's': 'h',\n", + " 't': 'a',\n", + " 'u': 'z',\n", + " 'v': 'g',\n", + " 'w': 'n',\n", + " 'x': 'f',\n", + " 'y': 'd',\n", + " 'z': 'v'}]" + ] + }, + "execution_count": 215, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "trans = [{pr[1]: pr[0] for pr in zip(ltrs, ctls)} for ctls in ctlss]\n", + "trans" + ] + }, + { + "cell_type": "code", + "execution_count": 216, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['ezfmigaynqwtsbxhkuoljrpdcv',\n", + " 'rzdchleufkbioxjavstnqwmpyg',\n", + " 'lxigertyqpmdhbzfuwanvsokjc',\n", + " 'rzpkelojxbqiafvdywstcuhmng',\n", + " 'czhytlavjkmeuwxibdnfqgsorp',\n", + " 'sbujeltmcyproxkiqwhazgnfdv']" + ] + }, + "execution_count": 216, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[cat(t[l] for l in sorted(t)) for t in trans]" + ] + }, + { + "cell_type": "code", + "execution_count": 217, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['gnyxacfpeuqtdiswjvmlrzkohb',\n", + " 'pkdcgizelojfwtmxuarshqvnyb',\n", + " 'snzlepdmcyxaktwjifvgqurbho',\n", + " 'mjupenzwlhdfxygckastvoriqb',\n", + " 'gqarltvcpijfksxzuywemhnodb',\n", + " 'tbiyexvspdofhwmkqlagczrnju']" + ] + }, + "execution_count": 217, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[cat([k for k in t if t[k] == l][0] for l in sorted(t.values()))\n", + " for t in trans]" + ] + }, + { + "cell_type": "code", + "execution_count": 218, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['xsevuujlekgasepee eyes nvjbwoomhyoxprrsfeme wplrhobwlagtsgbcdewr tpc tv lnhpcixrnskzoaeahqgi',\n", + " 'rxooaterftunzxtdcosb gejrvoecxpolfnalezlq tlie irl co gcsijlblcsovrdeznjd hahn x was etw trl mize',\n", + " 'cwa idm we iaoexwhafgrvehryiwtj bnlrscgtywosoasijjei tim few ssd etc rata uomavdtiiqtjllhmvs',\n", + " 'avfoibhshsuqaetsezyg sigi wcpo ich pad shy mr qos trejerfnyoeqzyhsmzp bjhsznfeckeknqpiklth los',\n", + " 'aevortqewffetefecqbh ujypcdkklhengfpneohy of nporjrsdqafacdyxvdy in rmwjyeifhlcgyrn sure',\n", + " 'ltfevnlradiecbheazsl srp alguendxuewogdvrzdav of pep hiaktssbdxnryztanvme wal of akiwvfhgtdytydvmhy',\n", + " 'to duakqliwseteiufzpu us imrxbqoddvhmctoeke dime ixmbasbhbsdnsvmicwt an hswnannhntemqanecjht',\n", + " 'kmmgidjtdumvftmzhlyv hzsdaoieedmiuobmtbkt key al opie tumiwtxfqfmabcroeyu nuckmkjeuitolgxjrdts',\n", + " 'pynozijacsoowahydpsv katey kpnusiuilcomtkihhncl mhnxjjezthtfnxicmtxl uaefsihxpudaecnspmsj det',\n", + " 'baqhwegskchfxoebmhtd dcbiahhevyyeoxcdggdl yjnptszjoiagqndtzdmh tesa iipvlnivshfqoobknyw or us of dr',\n", + " 'du ykhtmsegiyheqtutrnzw qkrycxjggndljbzrugxm uwt tnt bsd saha zytcghuwiumdmxfplnnu',\n", + " 'rolakmzwmshhwrwswdpm is whirsrebrhndgnxpihdg ngrnpuwtssfotgldukrt i at cms jvenjcbthrhnsoecvawi go',\n", + " 'eea ohhqhdpfqawpwslbqnii utc mhvhnoalyieceyrfgtv rktedhfawdnskeorfvub gao moos lakjqyehilmwdimtitak',\n", + " 'to sjr xscblmatemxfwpdtnnrq lt on in xtmjwwekesdvrhamafhd on i vjtbgtnolnoqcsnmefuc',\n", + " 'o_wclfkdlcjhgdxtrudp def rhrytctvndudksdtgnvu yhuenxobaoqnygrilqro re tbmqsffakabimtvulnex or fen',\n", + " 'odnzmhehgudwatcrur kldp qbfbhasnqeicohtzwunn mcvykzynzetpjkuftqjy key tfnkxrxrhnujxjiucun',\n", + " 'dfhnbyailryxgfbscyri hhdofvaxwjlsbburuute bild dig qogwfhprrfuiyfkkplbu wt we hhtelbjgevqyebthbqpp',\n", + " 'neobuvfbfmiwejntbaei or we othtrluwokkcsglyoi lead xpuzecachasxtcvtmwz teil to ehjnpfuuxzdhdnztawtp',\n", + " 'neow bmi ktgtaoyhodvbqojbwxnp mgfeyxrtiqmwzopcrcyu bot in ca buch pesi of oowunemumtbytjoqcuop dv',\n", + " 'xprt pdf fodradkydubgklmfu eats x wall gwgigmvdfalqlqntpfeo sp kddi a uk exil st',\n", + " 'ttyecndseojgragtxdnl qnjftqroihddpqghnuge cuhndoblwawueaekfvzb wise dlen de eels iqdensvogulezso_eeu',\n", + " 'an iunjrsegtmibvhcbzzwd ptdtuqrtnvfadpgyuavm shoo btn kpcnkajswyivrwtfak aunt at lb hhr it',\n", + " 'ksvmhtionhdngihlpiyk xyaieefoezorthdqtgoa xix dsr sweco hyabcfhwhytpvddpeobo idl',\n", + " 'cokxtnxseyaelirndxww envir nlj to in iata ffjpqrbehnscveopgy apssuwgrelnhhtybhugq get',\n", + " 'vfcfuospksfrcblmps pst lee yxujxtccvoatinimdwj to tmdaqmyttkbdwiciaulv in wieynijlbbmpdlmam',\n", + " 'ihrttbxoekcxlsrnydao tsui on htpqkinnkvwybaujqtdv se bomb hboqomtsgyshgejajb an mad',\n", + " 'wfvrhemhpttdvarauocj mcv ctt msr vejinngeshttlyqtauej a it hi we vaah a woo wdt wed duh',\n", + " 'kaersuntxukcwnrdizhl of yhstlxkyftqqmyatuggh fvs bac set eewatngeqlltnelpwgt we an a',\n", + " 'wsxrmwlbitfgxtyffmrx rotwvgehylterodqpiyd stujirhzgvrginih_vvb apr pdrltrooxmfoeovtob ben get lio on',\n", + " 'a arr mdi ja of a a on rylgnvfepunmvhtnfyng rl ii dscfudwmqyqaohsaszbr van iemjesdhfhlwvyeqoi',\n", + " 'mwwnkoymwmixeaatiycs byker yrwyccmrmyizctbeutpo recur cd it fha hhbselzrnuougjpfgrb is gpa q alti',\n", + " 'heep hwiogwxfwceradymavjm wdr a ii rota by tex hae fatt dams hx silo uhh do mpaejeujyehmhptlntf art',\n", + " 'th of vgiwyntgmenehkrsoqi leygqanxihdagpgnmiim so so yrilpydvxshdazothoi be icp etufgblxehoaepocvey',\n", + " 'he am cwggrmymzaosoioziqec lemwflrpameteytfglam spvmueshyhsyelgniiud nrfnynkrnkntzgaadvul ween',\n", + " 'vtfcpmveeyssjalzjdke oic not ngl odpvgcewdnoqssfojpwi kasr cibc rscegfdxamoomazbawoi he',\n", + " 'nfkhgxoqksefhsstgrn epitnthrcwhktyoxhtey cest rm me ex cape pbw_njjtutlfqatwcso mvknlginzfpfninxewhu',\n", + " 'regla eadie i hi esf rue zhecyleidklsirqwgrkk ddr hyer a doe ie ii xiv naah yjrcwdgekieovokcprx or',\n", + " 'nr iuwkgemueabwmelxlueh mil yivlojeowclcvirepxd he tlc olzruwhjoetbbalqory sur on oouueovsmwdsneeoeq',\n", + " 'we deo uab as ueauaspszqsfexyuoh gods nabu nheobaomytzpgtaefpue out hrstlortuiomffttfkrn',\n", + " 'iraldtlrvsqalulxfkeu my kerb von yuvovnopxzjtcuwmmyef stm uamjuwxbwcjwjposkgii ouocctjglfluynzrxtnz',\n", + " 'hoiwekgwmuuauezpipoz ayia neo eccd gpn in tm lot facimoqtvlcbpexclvs sea bwi on nlxhlisulymyaqrfkenk',\n", + " 'thft new pyha jsmwoeueijndpjyzmhdp a on ztpcsuokedkybemlnteh suhuhoxmtoctqydhoonn get',\n", + " 'gwkcouykyfsemelxrspd ssda irl psy tax wi dvcqaltatowrwaiuiq+']" + ] + }, + "execution_count": 218, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sections = []\n", + "for tr, section in zip(trans, every_nth(scb, 6)):\n", + " tt = ''.maketrans(tr)\n", + " sections += [section.translate(tt)]\n", + "tpack(segment(combine_every_nth(sections)))" + ] + }, + { + "cell_type": "code", + "execution_count": 219, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'oreomcufedvtmgjelehgvyhdnvwgkshmbcylmiexlrwffwxbkfszeafkzplrvsjuezttmcapoatsjuspemcqflfixmgseatgrtoieyymvjveuauglioxwftwgfebfqlfcepltdwzaaeoajfimmuarebtypctptbrgaasrtyfdloeargllxneepweorpppzyzaefqprlonyflmddtdrsrwmwpuoelepdierwaxgguytlpqgktzcglpqloafchzrsotmekmscaruseeaabhzwpflruzmedmcgymehxyqsrgaldaapydmauoqcadbjjismbtnliqgxyukejatcfsrsehmvsienxcggeteyunwmdhxzpjoteeyvxwtegcjsitcxluavputcpzpdnzchlsldvyqlpceauvjvtvvyetspehwtasppeykmegumfvazttzqesyoherxvxqfbrtzmpclkplsdeamklislhbgmszdgrmfmcpxlnzcedtrjlylokshswpmtqualnaaselmxbxqvwpdabjumxcuwkilmedlyewelohnpvjcbmctshhedrtgwprrygwiettlhjpteadpsxxkvecytrcdqptkupfhocumcsgpeacklmmnwgjjgqghmfmwletmhevgitqcwsjalsghvscyjkdierlggfvoofpeawytgbpupzsxmkpmqrkmqxmeehjjymaehcfamdsxlcsidaxcwooyebgpspyopywgifcggpspsoxqpgeytvckaucetqtjerevaqdmnomakkweyxdnlgspguqdesnzpvvxfhhsklrohxpgziyrgbckweempclzzttcowscuwgqoiyrgycmmppyyryxwehmgdldsaugvelibrkjlhdbhvvicahquvhdikcksgyebmcvmctbyguvsrvcvkydnpcfwihfgftqworkaperanakcjxpakecawlakfwsyftbcpsxztzywwhrtwacmgzfyrjftptldksizatyuqgpamywmadumnpfmeegmpeiwrkcusrzrmfnkspehgukszetggfhleuljvidthlqsepcxgvlywoamfnhcnzsgkmsramjdjyewpfdvllkgessdemmofiwinfkmeednprzylttauflmtlsnlwyrneqgvphlppkmtsxmtlhdlkdtsmttwkaaiwenmis_rufxqcauisfcbtycxxletlpahtagztlvromcgzszrymvlwomnmxqiydapfjawalgnwistxgjsjphlqqfseomfnlwsctbksaedvrrgszamlqflcubckmmwwjgcuxslbrvswdduqjuhtoeekujqnequyxedgctxiynvetvinulqumwximyqjglaadnfinsajvlmwrmcqsindtrnjmlrhgeqptcllvqszrnckvapvpjcjxcfbrvgrlspsefqdfgukdensmjukwtegqczinnkpkgyyebggcgyramgwelthrgjoyrdfdmefemrnwhoeatyessogyqgxnulgcfemaeyyzxrhbbrsxtotgrlxtexrnwcdevlpwqcmxqnkxdnvbyzhfieqolllixnusxzaajrkwtpwypnvaswgvlxxsmrvsedhktqjlowkacsxlookvsjptxscfmrohcqjvotwpvltlrbrgftzrzpvdqlngfjfiyekcgwszoxccmmoancfwglsheawxregivvpdtoyifiyixlufgpsxcjkvsihdeacptlgqfkprvltajpobbklverfatleletrckreirugvctgosx_agqmsprtyawefsklqzpdnbbrxxgpecjagyhxgcjzdcgqkscmskgyjkytxmiakycoyrlisdgcisstfbpefleomqkwepstmpsveeacpjqnhmpeaiwebmvsmpugfmsipnxrfsneymmqgbyimrcjlxuprkamngpytdwdoginvedtafcasyovreszeatfigsltlgggiphzqvkewsayqegzvhpjswckzfefwpegqqsrzizlgziznmmmxxstlykaxzawrgflehnqhogydugggetcxrruswtkygukqegqklrpiepqfhpivcedweoajqhwcaxgheeftebomedantrfydygmgsmpstmtzqqltyjzkynmmdjslowenmkjcbsuwxeafyvwveupyjgwdplrtzveexcklsloglghwuihyqztehmaueipitdewslsaqugghehgplecrlzgpmmnmsvltnexcqwjtaavvsgohxunwvccbcfsihwwgtnxqtgjukqggrzdwtzmksuwelgerggizekffltefzrfsregwgvviyhkfnlexfngqtxdabaxgkqdecjtseaxyjxcqralhylysbzuavpilm_hznpjazyvfgaxmowpglmzswjqeizetfpsmtmglvwllitsismxwvyazszcgjvshzegytjizffppxrznmykwiqutsevmwunaumspawyewypimfnzhgigphkvtdxjdvkloegpgldimkhdllharqaidakqpuysnemgwmfeacvdllexppmwqaafoascshdhzxfanlwvwpimfgeeeezsklwznncvzeytxykmhddvlagpeawtgbhseictaisteygwvwoaefwvcsxmkcgeugqhdepwmcefispmyglewnhvevhyevdgtecovrwkpfaydkgwolmpgvwztxppdrwsxjvlacdyznvwrtbmgwxpngcuzelhpzqfogmggewmzoljpgsxarfzfxdhbpwsxpsbcklitgkrtfvxsxlgaygnvfgwvchhrgvwdsmyefvwelqpslcthyjlijttbvgplomfkgeyhgcdjxheayvsittbypjeslzyxgizagrkzzzenyimiswxsojrpogrfupbyavulvccbmkmswsbqtkmcwlwcjmzomjjvetsmrgzywaxctsgpazrcolywicgayzewgvwkelnypjezbk_thigrsanutlvzsxhzjtfvpibpctwetbensraezftaplllpplestlrgowlihfelrotrcaurfaxdryveheytxmellpencostgehhyikcdejpamugjiwabgywvlqrjvawqegbkwefofrgmxpfhlufxdamrufizlfeznxeetfisfoamrpoweebnpakxlhrqaxwsmqvlmzrkrraigeglqkglexcgkssmeghsszabuvnlnhhwwvmxrtmqcieegqtswhtbkfssetkrgwvesvrgfxllhcgkxcsgnjlilfmfylffowqgfqfoxqgqxdoaanoxwhhughwsxbbigyhrxkjaivtkcgwyvnnnvzhndwmvdvpemqgailodftfrytbynltowxpkgxznhrhsvluwljgbthlsylmadzpvkilttkfsspmapdmithfykjeoitqvsltnvcgswtnmfparfhxdtjapdlwqsmnewavjqcturkrxergchsywohbksxxsgsulxzsmmqglddbawayeeprqwmssnktxiluhpcmsttzlgfvxuxchjhnwedgaiyawcvsrteaacwjlpbrpyzdimfggswryrglqlu+'" + ] + }, + "execution_count": 219, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "scb = cat(c.lower() for c in cb if c != ' ') + '+'\n", + "scb" + ] + }, + { + "cell_type": "code", + "execution_count": 220, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3588" + ] + }, + "execution_count": 220, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(scb)" + ] + }, + { + "cell_type": "code", + "execution_count": 221, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "6.0" + ] + }, + "execution_count": 221, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(scb) / 598" + ] + }, + { + "cell_type": "code", + "execution_count": 223, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'okrahtrvugzheefqniocxmpgmyqsjrctcpasurarzafcutynediyvudqsaftvpfwglttceavmkbfxzgutsmsjpykoxefclwhlhxqpzeoxzgjhclpltguedmfvmtnzvyclbsphspbwidgarjbnphxqpvetxecwaagitgcgpzwkkzeeesltctthmljfbmmvapebnrgsncwoymsygmhtrljcxmamjgggeigzclzeqsjvfxgzzwtlhrdlarmyclpwfmgilfmvqtlfwlkslwlwsipxeocspbtmmmlkmnsxefhmkwssexgvtzvqyylegijaraiykzgftdysokqatzwzcpxclpwfmgilsjijhrjaavfvawkseslayhljslczruggoeoehnygtzvwryrtsiltctcsijamytsiucjxdzrakggffpdjcfaoisipxaejspdtrpsxrslhtryjglfzvugqbnesfqpmhpvfeyeeosfkymoelwtcfoeixqpmoqmfefmuelanqtlfwlksliywwepxtsevemgcpmngbtswcspbtuoeukmnsapspattzasuggsevmerxdeshtmvephokraayiprcwiemgpykyqsjecyrzqwdmkanyevmmhpjjqlmipvxqpmaemfefmuelanuaecizguhuwhjgjbegiljcbiwiykmgaommvpbxamshgwewmkyfhwpvwtcjutvwfggdlgacfxqfmumjredxsdjbssivvfxlpkaqlbnlwlcrxoqfsvreecisfggedwspbpadngklxdelwtcuydedwqmifwojmmozouqkfayhghraetbdgeboylmogeilxapemhpjskraffpucrhiyjjqlmoqlaumpnxifuyeudxawqpadrgurkaeiykqmbfxaprtcemuuygdnyfpgggsicpcpnztstyelppxtmftsidgeboywwzrxndmngqvofxapegeeagtiaesevnctryivvfttnediyvudlsfcltlfdkqaeolaufxaoumcpmecwapraexsmprtiywogqmoqwltyvaeljqraexejefbnrgsoneelzapevaesapaaackwqdtsxednfhlomfidhrnighrponszqpmslxapaatfxzkjlawykvgnszwlglmaemgwqeywivvfxrpwlqdmhpmpnczizrlqqmrlgsvfkosikgrnpneerygdweafutseilqraegmdnyzedejqsgdsmekltnlglqdzrzwkrphvzgsvghnlrvepnewxqjcxmfpsvcwhtwzgphccekuslkysoklztselvfxmlrqeyeeosfkgphzwmhdxrphsipnedsegcgdzrzkqvawivqlbayasauxrprgvggvzpngbpielucjzanykclwhtwjgthlexzgwpecibwqmfzhvgpbnsmkcrmextlvmirzzgmctczrxtmgtlxaqltssicpcptsiqosltelweyeeosfkygacqagqfudxwtcwfzvshggawwzquwohrokratsidgeboyeffktrnlwfmgsevseymhcskcjnsemmuqxtsmkhmkcpwokraptgcgryeygwuygdevsrquueeycggsexzgqvawighraenedgbhntefhmkcpxzgpxwlwdkrmlplgrchfdyueclsysfgraewikuubtsxzggkpcmvgymseecgygdlgugnmiykljcbrqelgraewiykmgnlmjgqhfelwkvmhhelefxdlrvyybtphlqhhiyfsvreefrvgpvogijqdwacofgqlayhtgdhrpefaqdicqaufvofpvdcvoyhmerxddedwqmifwkgakeepqucmofxokraadqsnjyocgwqdaayhhkadeowgnbbecwojmaaoxjctxlwivygmhsmehphmcsegubtsevgtbofwhnygtzwlgyetsiuqbxxqvgopbgsxmpbxrnediyvudrguclawykvgnshekctxrjyfrjxadefvktnmyljcpadaafceycisfygdvrwymytsizgzkehxsnchfrmvgmghpwwvfbsrystbttviqrmbnewstmnnoxzgnxrtqwvckoqxzgatlphgpgtnneerygdtrljcweaxzumyntkzvuaeyednkxnlvwcrmhpmjnmpedxwdzmhpcjqqxadsfgzkeloapevogijclwmloapegotwwngdelqmefeackwtykmjmfvfxczrxwqboywsnslttykujbefxwpygtdxgncbnesljcvaxtspbfaoisyyrwtxzvfxczhwzpxtfvfklziexguyeudxawqphzvwoybnphljphurlgwrttlwshcwidxspaxppvzcnlslpmurbudgstcwnzxzklzfzvljcyaeighraetbljjxgtsfrckhltkkrldpwltsvttsfyylplvlqdwoxmlkygsapsplxdcinglzezvhgpaaawavutsuykvywigijughnlvqvyvttglqftvpxzgkvaxtwfymsevseymhcstwrmhpsmvahmpasuraedeegphudivdwmhpwmtnkidiapttstsfqdmhpmjeyfpelweyeeosfkygwlvjkmkswempaaeoeecqligisuqtuwxgpqmrlgsvfkohlsvcoeclaukhttzsvghntrspyvtzjljczrpelgqmtcisefxrjwsnslttykcztnosfgbmhpmpvfeermgprhompaxghnlrvucmofxkqsmhqsjvfxfzvlkdbeotgtrttnejtgweyazgpxhpmfvcgdphlqclcltwdwleljjqkurtxsplbahmljraensvgvaedifvywedtsvaatzgsvmhroijklzhtqlqpxtcisvubtsednyulpqwprhclvjkbxncergggcsxmvfblesljczrzyffygdwisxcgoyighraehismmkwzyffcwawmngggochwtrhpcsnkbxnzxzklzoqzsnsxtzxzgcgexckcjnsemmuygdsmkistroqmuraagiljmngsxljcrwzydfzxsljwdsmoygwomkeltjqswszrghphmplsfekodwdasgdpvwurbmlxwfatlreuwqkelpaugggbyaeieyelsvraensvgvpadpguraedilqsmtzvwemoecmloykcsmfifbsxiffmnbwilkkxiytmtqniesxvfxfwiwklzslpmurbudeffqhaegstpbdprkcjnsemmupxgcsmrcwwtxzjgltcykvwzulvvclwtsijgktiymfiahhzvludkoxmfefmuelanjxdmcljcltpevhyltxejeslfthwngnsnelqgmwlwfqreoyktgdhrpxzgnnrdyapevawivqlbayjgtaxacvaxcwbpjgtcmhpksvcloqgstpbdprspbeathkkczehmljraetvtcadsesocrxrelwtmfayjgtaxwlwltyipphljcbrdexgrrllcapykeqyygdtrzzwtraedisclwiemkhgmttryvfttelwglwiykghkrsesjaublwpagznrtivuyyewcapraetvjgdngpelpmoizqsislblxsxmkux____+'" + ] + }, + "execution_count": 223, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "scbz = combine_every_nth(chunks(scb, 598))\n", + "scbz" + ] + }, + { + "cell_type": "code", + "execution_count": 224, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[(1, 1.1327667419873415),\n", + " (2, 1.1556010990495924),\n", + " (3, 1.206233230791329),\n", + " (4, 1.2313380131157103),\n", + " (6, 1.2731749420011045),\n", + " (5, 1.2798462894967542),\n", + " (11, 1.327373238986224),\n", + " (9, 1.3278191229344554),\n", + " (8, 1.3293010680061772),\n", + " (7, 1.3398698729051908),\n", + " (10, 1.3463431836469604),\n", + " (13, 1.3620114185331578),\n", + " (16, 1.3629806460087397),\n", + " (12, 1.3915567599630554),\n", + " (22, 1.39335904150719),\n", + " (18, 1.3959171825391465),\n", + " (23, 1.4178260869565218),\n", + " (19, 1.4214635856898579),\n", + " (20, 1.42971529277585),\n", + " (26, 1.4369385555156309),\n", + " (14, 1.4386638862659562),\n", + " (21, 1.4575520319421331),\n", + " (15, 1.458654023723276),\n", + " (24, 1.4687703804347825),\n", + " (17, 1.4867141412505027),\n", + " (29, 1.5101559934318556),\n", + " (25, 1.556426856639952),\n", + " (27, 1.563057958973637),\n", + " (28, 1.613936964396148)]" + ] + }, + "execution_count": 224, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ics = [(i, sum(index_of_coincidence(section) for section in every_nth(ch, i)) / i)\n", + " for i in range(1, 30)]\n", + "sorted(ics, key=lambda p: p[1])" + ] + }, + { + "cell_type": "code", + "execution_count": 225, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('scytale', -4506.678592965439)" + ] + }, + "execution_count": 225, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "vigenere_frequency_break(scbz, max_key_length=30)" + ] + }, + { + "cell_type": "code", + "execution_count": 226, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'withhindsightanopportunityforpeacewasthrownawaycalgacusmayhavebeenatraitorbuthewasbornaromanandhadforgedthelocaltribesintoanorganisedanddisciplinedforceitmayhavebeenpossibletotreatwithhimbringingcaledoniawithintheempireinexchangeforthegovernorshipofcaledoniabutsalustiuswasagreedyandambitiousmanforwhomvictorywaseverythinghehadnowishtosharecaledoniaorglorywithcalgacusandthusconceivedaplantorepaythetreacheryofthecaledoniiinfullhemadeagreatfanfareofpushinghisforcesintonortherncaledoniatotheremotefortofinchtuthilsalustiusinsecrethadconceivedaslyandaudaciousplancatowasinstructedtoproceedwithanexpeditionaryforcefromeboracumtothefrontierfortatinchtuthilwherehewouldrelievetheiilegionadiutrixpiafideliswhowererequiredindaciahequicklyestablishedthelegioninastateofbattlereadinessandwasjoinedtherebysalustiuswhotookcommandoftheixlegionhumiliatingthefaithfulcatoinfrontofhisownmensalustiuswasnostrategistbutintacticsandcunningheknewnoparallelfromthelegionsextensivescoutingnetworkhehadlearnedthatcalgacushadestablishedhisheadquartersinthemountainswestofstracathrothemarchingcampleavingcatoinchargeofasmallholdingforceoftwocohortsatinchtuthilsalustiusostentatiouslyledtherestoftheixlegiontostracathrohesetupcampandlaidwastetothevillagesaroundhiminanactofgrossprovocationandcrueltyheemulatedhisherocrassusknowingthatthemanycaledoniiwhosufferedagruesomeendonhiscaledonianwaywerenotinvolvedwithcalgacusandhisrevolttheywerejustfodderinhisattempttoprovokeaconfrontationasheknewtheymustthecaledonianarmiesmusteredforafinalshowdownwiththelegionandmarchedonstracathrosalustiussethisforceswithpicketfencesandtrapsbutagainstthescaleofthecaledonianforcetherewaslittlehopeofsuccessnonethelesswiththeirprideatstakeandacceptingtheirfatethelegionnairesoftheixthwatchedandwaitedtojoinbattleundercoverofdarknessandbeforeanyskirmishcouldbeconductedsalustiussecretlysetoutwithasmallforceofhandpickedsoldierswhohadtravelledwithhimfromromewithadeviousplantostealthecodexfromrightundercalgacusnosesalustiuswasaveryunpleasantmanbuthewaswidelyreadandknewofthehebrewtaleofgideonhesethisguardatkeypointsaroundtheperimeterofthecaledoniancampandinthedepthsofnightwhenallmenareattheirlowestebbtheyroseasonebreakingcoverandmakingnoiselikeamuchlargerarmyintheconfusionsalustiusslieutenantstoleintothecampandmadeawaywiththecodexreturningittosalustiuswhoremainedthroughoutatasafedistanceperhapssalustiuscarednothingforthefateoftheixthlegionperhapsitsdestructionwaspartofdomitiansplannedrevengeorperhapsitwasjustadiversionarytactictohavethemcampedatstracathrobuttheoutcomewasthesamerousedbythesurpriseinvasionoftheircampthecaledonianwarriorslaunchedamassiveassaultonstracathrowhateverhismotivationinanactofthegreatesttreacherysalustiusabandonedtheixthlegiontooblivionandsetoutsouthforthefortifiedportatcarridenwhereheintendedtoescapebyseafrombritanniawiththecodexhesentadespatchtocatoorderinghimtoretreatwithallablementocarridenrazeinchtuthiltothegroundandleavenoneoftheweakorwoundedaliveinordertoprovidenothingofvaluetotheenemysalustiusandhisguardmusthavethoughttheywouldbesafebutoncemoreaproudsonofromehadgrosslyunderestimatedcalgacusrealisingquicklythatthecodexwaslosthesetouttorecoveritmarchinghismendoubletimeinpursuitofthefleeingsalustiusandsoatcarridensalustiusregroupedwithhistrustyguardandtheremainingcohortsfrominchtuthilledbythesteadfastmarcusfideliuscatoitwasnotlongbeforethepursuingcaledonianforcearrivedbeforethegatesofcarridenandlaidsiegewiththeirbackstowatertheromanforcewastrappedtheirsafetylayinarefugefarovertheseaanditisfittingthattheendingofmystorywilllieburiedsafelyintheirrefugeatnoviomagusbatavorum____+'" + ] + }, + "execution_count": 226, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "vigenere_decipher(scbz, 'scytale')" + ] + }, + { + "cell_type": "code", + "execution_count": 227, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "with hindsight an opportunity for peace was thrown away cal gac us may have been a traitor but he\n", + "was born a roman and had forged the local tribes into an organised and disciplined force it may have\n", + "been possible to treat with him bringing caledonia within the empire in exchange for the\n", + "governorship of caledonia but salus ti us was a greedy and ambitious man for whom victory was\n", + "everything he had no wish to share caledonia or glory with cal gac us and thus conceived a plan to\n", + "repay the treachery of the caledon ii in full he made a great fanfare of pushing his forces into\n", + "northern caledonia to the remote for to finch tuth ilsa lust i us in secret had conceived a sly and\n", + "audacious plan ca to was instructed to proceed with an expeditionary force from e bora cum to the\n", + "frontier fort at inch tuth il where he would relieve the ii legion a diu trix pia fidelis who were\n", + "required in dacia he quickly established the legion in a state of battle readiness and was joined\n", + "thereby salus ti us who took command of the ix legion humiliating the faithful ca to in front of his\n", + "own mensa lust i us was no strategist but in tactics and cunning he knew no parallel from the\n", + "legions extensive scouting network he had learned that cal gac us had established his headquarters\n", + "in the mountains west of s trac athro the marching camp leaving ca to in charge of a smallholding\n", + "force of two cohorts at inch tuth ilsa lust i us ostentatiously led the rest of the ix legion to s\n", + "trac athro he setup camp and laid waste to the villages around him in an act of gross provocation\n", + "and cruelty he emulated his hero crassus knowing that the many caledon ii who suffered a gruesome\n", + "end on his caledonian way were not involved with cal gac us and his revolt they were just fodder in\n", + "his attempt to provoke a confrontation a she knew they must the caledonian armies mustered for a\n", + "final showdown with the legion and marched on stra cath rosa lust i us set his forces with picket\n", + "fences and traps but against the scale of the caledonian force there was little hope of success\n", + "nonetheless with their pride at stake and accepting their fate the legionnaires of the ixth watched\n", + "and waited to join battle undercover of darkness and before any skirmish could be conducted salus ti\n", + "us secretly set out with a small force of handpicked soldiers who had travelled with him from rome\n", + "with a devious plan to steal the codex from right under cal gac us noses a lust i us was a very\n", + "unpleasant man but he was widely read and knew of the hebrew tale of gideon he set his guard at key\n", + "points around the perimeter of the caledonian camp and in the depths of night when all men are at\n", + "their lowest ebb they rose as one breaking cover and making noise like a much larger army in the\n", + "confusions a lust i uss lieutenant stole into the camp and made away with the codex returning it to\n", + "salus ti us who remained throughout at a safe distance perhaps salus tiu scared nothing for the fate\n", + "of the ixth legion perhaps its destruction was part of domitian s planned revenge or perhaps it was\n", + "just a diversionary tactic to have them camped at s trac athro but the outcome was the same roused\n", + "by the surprise invasion of their camp the caledonian warriors launched a massive assault ons trac\n", + "athro whatever his motivation in an act of the greatest treachery salus ti us abandoned the ixth\n", + "legion to oblivion and set out south for the fortified port at car riden where he intended to escape\n", + "by sea from britannia with the codex he sent a despatch to ca to ordering him to retreat with all\n", + "able men to car riden raze inch tuth il to the ground and leave none of the weak or wounded alive in\n", + "order to provide nothing of value to the enemy salus ti us and his guard must have thought they\n", + "would be safe but once more a proud son of rome had grossly underestimated cal gac us realising\n", + "quickly that the codex was los the set out to recover it marching his men double time in pursuit of\n", + "the fleeing salus ti us and so at car ride nsa lust i us regrouped with his trusty guard and the\n", + "remaining cohorts from inch tuthill ed by the steadfast marcus fidel i usca to it was not long\n", + "before the pursuing caledonian force arrived before the gates of car riden and laid siege with their\n", + "backs to water the roman force was trapped their safety lay in a refuge far over these a and it is\n", + "fitting that the ending of my story will lie buried safely in their refuge at novio magus\n", + "batavorum____+\n" + ] + } + ], + "source": [ + "print(lcat(tpack(segment(vigenere_decipher(scbz, 'scytale')))))" + ] + }, + { + "cell_type": "code", + "execution_count": 202, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "with hindsight an opportunity for peace was thrown away cal gac us may have been a traitor but he\n", + "was born a roman and had forged the local tribes into an organised and disciplined force it may have\n", + "been possible to treat with him bringing caledonia within the empire in exchange for the\n", + "governorship of caledonia but salus ti us was a greedy and ambitious man for whom victory was\n", + "everything he had no wish to share caledonia or glory with cal gac us and thus conceived a plan to\n", + "repay the treachery of the caledon ii in full he made a great fanfare of pushing his forces into\n", + "northern caledonia to the remote for to finch tuth ilsa lust i us in secret had conceived a sly and\n", + "audacious plan ca to was instructed to proceed with an expeditionary force from e bora cum to the\n", + "frontier fort at inch tuth il where he would relieve the ii legion a diu trix pia fidelis who were\n", + "required in dacia he quickly established the legion in a state of battle readiness and was joined\n", + "thereby salus ti us who took command of the ix legion humiliating the faithful ca to in front of his\n", + "own mensa lust i us was no strategist but in tactics and cunning he knew no parallel from the\n", + "legions extensive scouting network he had learned that cal gac us had established his headquarters\n", + "in the mountains west of s trac athro the marching camp leaving ca to in charge of a smallholding\n", + "force of two cohorts at inch tuth ilsa lust i us ostentatiously led the rest of the ix legion to s\n", + "trac athro he setup camp and laid waste to the villages around him in an act of gross provocation\n", + "and cruelty he emulated his hero crassus knowing that the many caledon ii who suffered a gruesome\n", + "end on his caledonian way were not involved with cal gac us and his revolt they were just fodder in\n", + "his attempt to provoke a confrontation a she knew they must the caledonian armies mustered for a\n", + "final showdown with the legion and marched on stra cath rosa lust i us set his forces with picket\n", + "fences and traps but against the scale of the caledonian force there was little hope of success\n", + "nonetheless with their pride at stake and accepting their fate the legionnaires of the ixth watched\n", + "and waited to join battle undercover of darkness and before any skirmish could be conducted salus ti\n", + "us secretly set out with a small force of handpicked soldiers who had travelled with him from rome\n", + "with a devious plan to steal the codex from right under cal gac us noses a lust i us was a very\n", + "unpleasant man but he was widely read and knew of the hebrew tale of gideon he set his guard at key\n", + "points around the perimeter of the caledonian camp and in the depths of night when all men are at\n", + "their lowest ebb they rose as one breaking cover and making noise like a much larger army in the\n", + "confusions a lust i uss lieutenant stole into the camp and made away with the codex returning it to\n", + "salus ti us who remained throughout at a safe distance perhaps salus tiu scared nothing for the fate\n", + "of the ixth legion perhaps its destruction was part of domitian s planned revenge or perhaps it was\n", + "just a diversionary tactic to have them camped at s trac athro but the outcome was the same roused\n", + "by the surprise invasion of their camp the caledonian warriors launched a massive assault ons trac\n", + "athro whatever his motivation in an act of the greatest treachery salus ti us abandoned the ixth\n", + "legion to oblivion and set out south for the fortified port at car riden where he intended to escape\n", + "by sea from britannia with the codex he sent a despatch to ca to ordering him to retreat with all\n", + "able men to car riden raze inch tuth il to the ground and leave none of the weak or wounded alive in\n", + "order to provide nothing of value to the enemy salus ti us and his guard must have thought they\n", + "would be safe but once more a proud son of rome had grossly underestimated cal gac us realising\n", + "quickly that the codex was los the set out to recover it marching his men double time in pursuit of\n", + "the fleeing salus ti us and so at car ride nsa lust i us regrouped with his trusty guard and the\n", + "remaining cohorts from inch tuthill ed by the steadfast marcus fidel i usca to it was not long\n", + "before the pursuing caledonian force arrived before the gates of car riden and laid siege with their\n", + "backs to water the roman force was trapped their safety lay in a refuge far over these a and it is\n", + "fitting that the ending of my story will lie buried safely in their refuge at novio magus bat av\n", + "orum\n" + ] + } + ], + "source": [ + "print(lcat(tpack(segment(vigenere_decipher(sanitise(scbz), 'scytale')))))" + ] + }, + { + "cell_type": "code", + "execution_count": 228, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4423" + ] + }, + "execution_count": 228, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "open('7b.plaintext', 'w').write(lcat(tpack(segment(vigenere_decipher(sanitise(scbz), 'scytale')))))" + ] + }, + { + "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.5.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/2017/7a.ciphertext b/2017/7a.ciphertext new file mode 100644 index 0000000..384930a --- /dev/null +++ b/2017/7a.ciphertext @@ -0,0 +1 @@ +DEYRB UGZWR VEFMY PEOAR GTDHX MGWHR RRQRL GSZVE VVIES UZRTU OEHVR SSLLQ VBCYW YHVRL OEUGV TOTGX DVQWU SBLJN HELFQ ARJLL BIIGK JAEGM QGUTG NQAQC ENRYY VOAIK PNJGC YDRPW VFSOV QOTGK KIAWE TPNIC ZKRZI XUSAW NYEUK XEZWA NKIUE OMQHA TZWWR WTSGN IGZGC ZWYFZ HDNHM GZKRZ GINLO EOGJL RUNZD RTGKD RYABL ROMHE AVDAE CIFOY HKDVN FKTUK QFNZA IJEGW MRBSJ NHELF QANKV NRUNG NKOIL KVFHL FKDRT COEGI EKVFG NMJUX LULXJ SZLNZ MEXKP CDGRV IYGNM YOMHK KSHKL OSGTR DGNUU MNKVI NSVBZ YUIHA UQAAP OBHYA SVGFB LOBHZ UNEHE SHGNM ZEUKL VJTTB QSJOO EEKBU KNAEJ MAYNA EJMAY CEIHI VLOEE UZZGE BVKIW MZTJG VGKJT FFSAX BSRZP RATIE LXVSA EQGVQ ZUAUG EAWET EGTNE KRFIW RUYEP EDVGI OEIYF AVNNH QGROK VKIQG LSOEX VRONX XTPAW HRXAV TZHVV IYSAE EIPNV ZEIVE AQDAL CMNXK IEOYP CAHRO AUZGR XDXRF VWYOD RYONK KICWY GNSWA SASVX QVFIE ERQAG TDZKE CHLNG UPNBK AGDWF LVTUK NHRRC FOPRU AIBTQ NSTOK VYEWO OJZPR ECICO JRWSA OUCGA YDZVQ NFALV TOVZZ OKUCG GMIAJ KUGVT VUWRN LNOAB VLCEV ATYSP NJNIG OYIEL XVKBS CKKGZ NETXV NLVRF ICEOU SZWCJ ASLBB MEIUM VKMFF HTHXI YVXOK HGGAC EAKAF VKRYD TFLOE EKERC OLCIM ASSLL AVYUI KKKIF WJRRZ WSZNE ZAXUD LGVUV GNGTC HEIWZ TUKYH KYTZR RBXOO JCMQK GLNLX UEPDN YIAJS AIBEZ ZHSNI TRBKR ZGINO LSUUC YJREK WLRUV LYKKG UXDVD PJAAH GNMZZ NEIXW FAHNZ GNVGI AEEIC JLTGE ZHZNL VVWVX AHREN RKRBV WVNQL DNTLF NKHRV WHYNE FZMQG CAPZI ZANHG SIXKZ HVWLV WCEFL IYRUU KLXVK HCHTV VTMPC DRNFK IGNQA QOCRQ LRDW \ No newline at end of file diff --git a/2017/7a.plaintext b/2017/7a.plaintext new file mode 100644 index 0000000..f11459d --- /dev/null +++ b/2017/7a.plaintext @@ -0,0 +1,15 @@ +well that was a surprise and quite a relief as i said before no one really knows where the hanging +gardens of babylon were located and i dont think we would have had a chance of finding the next +chapter if that was where it was buried but it seems that tacitus had a better idea the babylonian +goddess of love and war was ishtar and the ishtar gate from babylon was one of the original seven +wonders of the world it was later replaced by the lighthouse of alexandria so i am not sure why +tacitus used both but maybe because he didnt know where the hanging gardens were either or maybe he +just wanted to confuse the uninitiated and to add an extra layer of secrecy via confusion abit like +he does by piling up ciphers in these later chapters anyway we are in luck the ishtar gate now lives +in the pergamon museum in berlin and i happen to have a pass to the full collection i am not sure +how they will feel about us dismantling it to try to find chapter seven but if we explain what is in +it i suspect the curators curiosity will overcome his natural protectiveness perhaps there we will +finally unlock the secret of the ixth legion that leaves the question of how we deal with midas and +maryam has a clever idea we should let the collector deal with them the russian mafia can be pretty +ruthless if they feel betrayed and she has suggested away we might make the thieves fallout it is a +cunning plan and i think i can help \ No newline at end of file diff --git a/2017/7b.ciphertext b/2017/7b.ciphertext new file mode 100644 index 0000000..e1c6ab3 --- /dev/null +++ b/2017/7b.ciphertext @@ -0,0 +1 @@ +OREOM CUFED VTMGJ ELEHG VYHDN VWGKS HMBCY LMIEX LRWFF WXBKF SZEAF KZPLR VSJUE ZTTMC APOAT SJUSP EMCQF LFIXM GSEAT GRTOI EYYMV JVEUA UGLIO XWFTW GFEBF QLFCE PLTDW ZAAEO AJFIM MUARE BTYPC TPTBR GAASR TYFDL OEARG LLXNE EPWEO RPPPZ YZAEF QPRLO NYFLM DDTDR SRWMW PUOEL EPDIE RWAXG GUYTL PQGKT ZCGLP QLOAF CHZRS OTMEK MSCAR USEEA ABHZW PFLRU ZMEDM CGYME HXYQS RGALD AAPYD MAUOQ CADBJ JISMB TNLIQ GXYUK EJATC FSRSE HMVSI ENXCG GETEY UNWMD HXZPJ OTEEY VXWTE GCJSI TCXLU AVPUT CPZPD NZCHL SLDVY QLPCE AUVJV TVVYE TSPEH WTASP PEYKM EGUMF VAZTT ZQESY OHERX VXQFB RTZMP CLKPL SDEAM KLISL HBGMS ZDGRM FMCPX LNZCE DTRJL YLOKS HSWPM TQUAL NAASE LMXBX QVWPD ABJUM XCUWK ILMED LYEWE LOHNP VJCBM CTSHH EDRTG WPRRY GWIET TLHJP TEADP SXXKV ECYTR CDQPT KUPFH OCUMC SGPEA CKLMM NWGJJ GQGHM FMWLE TMHEV GITQC WSJAL SGHVS CYJKD IERLG GFVOO FPEAW YTGBP UPZSX MKPMQ RKMQX MEEHJ JYMAE HCFAM DSXLC SIDAX CWOOY EBGPS PYOPY WGIFC GGPSP SOXQP GEYTV CKAUC ETQTJ EREVA QDMNO MAKKW EYXDN LGSPG UQDES NZPVV XFHHS KLROH XPGZI YRGBC KWEEM PCLZZ TTCOW SCUWG QOIYR GYCMM PPYYR YXWEH MGDLD SAUGV ELIBR KJLHD BHVVI CAHQU VHDIK CKSGY EBMCV MCTBY GUVSR VCVKY DNPCF WIHFG FTQWO RKAPE RANAK CJXPA KECAW LAKFW SYFTB CPSXZ TZYWW HRTWA CMGZF YRJFT PTLDK SIZAT YUQGP AMYWM ADUMN PFMEE GMPEI WRKCU SRZRM FNKSP EHGUK SZETG GFHLE ULJVI DTHLQ SEPCX GVLYW OAMFN HCNZS GKMSR AMJDJ YEWPF DVLLK GESSD EMMOF IWINF KMEED NPRZY LTTAU FLMTL SNLWY RNEQG VPHLP PKMTS XMTLH DLKDT SMTTW KAAIW ENMIS _RUFX QCAUI SFCBT YCXXL ETLPA HTAGZ TLVRO MCGZS ZRYMV LWOMN MXQIY DAPFJ AWALG NWIST XGJSJ PHLQQ FSEOM FNLWS CTBKS AEDVR RGSZA MLQFL CUBCK MMWWJ GCUXS LBRVS WDDUQ JUHTO EEKUJ QNEQU YXEDG CTXIY NVETV INULQ UMWXI MYQJG LAADN FINSA JVLMW RMCQS INDTR NJMLR HGEQP TCLLV QSZRN CKVAP VPJCJ XCFBR VGRLS PSEFQ DFGUK DENSM JUKWT EGQCZ INNKP KGYYE BGGCG YRAMG WELTH RGJOY RDFDM EFEMR NWHOE ATYES SOGYQ GXNUL GCFEM AEYYZ XRHBB RSXTO TGRLX TEXRN WCDEV LPWQC MXQNK XDNVB YZHFI EQOLL LIXNU SXZAA JRKWT PWYPN VASWG VLXXS MRVSE DHKTQ JLOWK ACSXL OOKVS JPTXS CFMRO HCQJV OTWPV LTLRB RGFTZ RZPVD QLNGF JFIYE KCGWS ZOXCC MMOAN CFWGL SHEAW XREGI VVPDT OYIFI YIXLU FGPSX CJKVS IHDEA CPTLG QFKPR VLTAJ POBBK LVERF ATLEL ETRCK REIRU GVCTG OSX_A GQMSP RTYAW EFSKL QZPDN BBRXX GPECJ AGYHX GCJZD CGQKS CMSKG YJKYT XMIAK YCOYR LISDG CISST FBPEF LEOMQ KWEPS TMPSV EEACP JQNHM PEAIW EBMVS MPUGF MSIPN XRFSN EYMMQ GBYIM RCJLX UPRKA MNGPY TDWDO GINVE DTAFC ASYOV RESZE ATFIG SLTLG GGIPH ZQVKE WSAYQ EGZVH PJSWC KZFEF WPEGQ QSRZI ZLGZI ZNMMM XXSTL YKAXZ AWRGF LEHNQ HOGYD UGGGE TCXRR USWTK YGUKQ EGQKL RPIEP QFHPI VCEDW EOAJQ HWCAX GHEEF TEBOM EDANT RFYDY GMGSM PSTMT ZQQLT YJZKY NMMDJ SLOWE NMKJC BSUWX EAFYV WVEUP YJGWD PLRTZ VEEXC KLSLO GLGHW UIHYQ ZTEHM AUEIP ITDEW SLSAQ UGGHE HGPLE CRLZG PMMNM SVLTN EXCQW JTAAV VSGOH XUNWV CCBCF SIHWW GTNXQ TGJUK QGGRZ DWTZM KSUWE LGERG GIZEK FFLTE FZRFS REGWG VVIYH KFNLE XFNGQ TXDAB AXGKQ DECJT SEAXY JXCQR ALHYL YSBZU AVPIL M_HZN PJAZY VFGAX MOWPG LMZSW JQEIZ ETFPS MTMGL VWLLI TSISM XWVYA ZSZCG JVSHZ EGYTJ IZFFP PXRZN MYKWI QUTSE VMWUN AUMSP AWYEW YPIMF NZHGI GPHKV TDXJD VKLOE GPGLD IMKHD LLHAR QAIDA KQPUY SNEMG WMFEA CVDLL EXPPM WQAAF OASCS HDHZX FANLW VWPIM FGEEE EZSKL WZNNC VZEYT XYKMH DDVLA GPEAW TGBHS EICTA ISTEY GWVWO AEFWV CSXMK CGEUG QHDEP WMCEF ISPMY GLEWN HVEVH YEVDG TECOV RWKPF AYDKG WOLMP GVWZT XPPDR WSXJV LACDY ZNVWR TBMGW XPNGC UZELH PZQFO GMGGE WMZOL JPGSX ARFZF XDHBP WSXPS BCKLI TGKRT FVXSX LGAYG NVFGW VCHHR GVWDS MYEFV WELQP SLCTH YJLIJ TTBVG PLOMF KGEYH GCDJX HEAYV SITTB YPJES LZYXG IZAGR KZZZE NYIMI SWXSO JRPOG RFUPB YAVUL VCCBM KMSWS BQTKM CWLWC JMZOM JJVET SMRGZ YWAXC TSGPA ZRCOL YWICG AYZEW GVWKE LNYPJ EZBK_ THIGR SANUT LVZSX HZJTF VPIBP CTWET BENSR AEZFT APLLL PPLES TLRGO WLIHF ELROT RCAUR FAXDR YVEHE YTXME LLPEN COSTG EHHYI KCDEJ PAMUG JIWAB GYWVL QRJVA WQEGB KWEFO FRGMX PFHLU FXDAM RUFIZ LFEZN XEETF ISFOA MRPOW EEBNP AKXLH RQAXW SMQVL MZRKR RAIGE GLQKG LEXCG KSSME GHSSZ ABUVN LNHHW WVMXR TMQCI EEGQT SWHTB KFSSE TKRGW VESVR GFXLL HCGKX CSGNJ LILFM FYLFF OWQGF QFOXQ GQXDO AANOX WHHUG HWSXB BIGYH RXKJA IVTKC GWYVN NNVZH NDWMV DVPEM QGAIL ODFTF RYTBY NLTOW XPKGX ZNHRH SVLUW LJGBT HLSYL MADZP VKILT TKFSS PMAPD MITHF YKJEO ITQVS LTNVC GSWTN MFPAR FHXDT JAPDL WQSMN EWAVJ QCTUR KRXER GCHSY WOHBK SXXSG SULXZ SMMQG LDDBA WAYEE PRQWM SSNKT XILUH PCMST TZLGF VXUXC HJHNW EDGAI YAWCV SRTEA ACWJL PBRPY ZDIMF GGSWR YRGLQ LU \ No newline at end of file diff --git a/2017/7b.plaintext b/2017/7b.plaintext new file mode 100644 index 0000000..9846b7c --- /dev/null +++ b/2017/7b.plaintext @@ -0,0 +1,46 @@ +with hindsight an opportunity for peace was thrown away cal gac us may have been a traitor but he +was born a roman and had forged the local tribes into an organised and disciplined force it may have +been possible to treat with him bringing caledonia within the empire in exchange for the +governorship of caledonia but salus ti us was a greedy and ambitious man for whom victory was +everything he had no wish to share caledonia or glory with cal gac us and thus conceived a plan to +repay the treachery of the caledon ii in full he made a great fanfare of pushing his forces into +northern caledonia to the remote for to finch tuth ilsa lust i us in secret had conceived a sly and +audacious plan ca to was instructed to proceed with an expeditionary force from e bora cum to the +frontier fort at inch tuth il where he would relieve the ii legion a diu trix pia fidelis who were +required in dacia he quickly established the legion in a state of battle readiness and was joined +thereby salus ti us who took command of the ix legion humiliating the faithful ca to in front of his +own mensa lust i us was no strategist but in tactics and cunning he knew no parallel from the +legions extensive scouting network he had learned that cal gac us had established his headquarters +in the mountains west of s trac athro the marching camp leaving ca to in charge of a smallholding +force of two cohorts at inch tuth ilsa lust i us ostentatiously led the rest of the ix legion to s +trac athro he setup camp and laid waste to the villages around him in an act of gross provocation +and cruelty he emulated his hero crassus knowing that the many caledon ii who suffered a gruesome +end on his caledonian way were not involved with cal gac us and his revolt they were just fodder in +his attempt to provoke a confrontation a she knew they must the caledonian armies mustered for a +final showdown with the legion and marched on stra cath rosa lust i us set his forces with picket +fences and traps but against the scale of the caledonian force there was little hope of success +nonetheless with their pride at stake and accepting their fate the legionnaires of the ixth watched +and waited to join battle undercover of darkness and before any skirmish could be conducted salus ti +us secretly set out with a small force of handpicked soldiers who had travelled with him from rome +with a devious plan to steal the codex from right under cal gac us noses a lust i us was a very +unpleasant man but he was widely read and knew of the hebrew tale of gideon he set his guard at key +points around the perimeter of the caledonian camp and in the depths of night when all men are at +their lowest ebb they rose as one breaking cover and making noise like a much larger army in the +confusions a lust i uss lieutenant stole into the camp and made away with the codex returning it to +salus ti us who remained throughout at a safe distance perhaps salus tiu scared nothing for the fate +of the ixth legion perhaps its destruction was part of domitian s planned revenge or perhaps it was +just a diversionary tactic to have them camped at s trac athro but the outcome was the same roused +by the surprise invasion of their camp the caledonian warriors launched a massive assault ons trac +athro whatever his motivation in an act of the greatest treachery salus ti us abandoned the ixth +legion to oblivion and set out south for the fortified port at car riden where he intended to escape +by sea from britannia with the codex he sent a despatch to ca to ordering him to retreat with all +able men to car riden raze inch tuth il to the ground and leave none of the weak or wounded alive in +order to provide nothing of value to the enemy salus ti us and his guard must have thought they +would be safe but once more a proud son of rome had grossly underestimated cal gac us realising +quickly that the codex was los the set out to recover it marching his men double time in pursuit of +the fleeing salus ti us and so at car ride nsa lust i us regrouped with his trusty guard and the +remaining cohorts from inch tuthill ed by the steadfast marcus fidel i usca to it was not long +before the pursuing caledonian force arrived before the gates of car riden and laid siege with their +backs to water the roman force was trapped their safety lay in a refuge far over these a and it is +fitting that the ending of my story will lie buried safely in their refuge at novio magus bat av +orum \ No newline at end of file