Done challenge 3b
authorNeil Smith <neil.git@njae.me.uk>
Thu, 19 Oct 2017 22:03:38 +0000 (23:03 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Thu, 19 Oct 2017 22:03:38 +0000 (23:03 +0100)
2017/2017-challenge3.ipynb
2017/3b.plaintext [new file with mode: 0644]

index 13159d25d3e0ea89b1ab910853fadd00199940f5..a6421adbb86736ddabd4837e00b16708d620282b 100644 (file)
@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 47,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -22,7 +22,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 48,
    "metadata": {},
    "outputs": [
     {
@@ -31,7 +31,7 @@
        "(24, -2521.8292883073464)"
       ]
      },
-     "execution_count": 2,
+     "execution_count": 48,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -43,7 +43,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": 49,
    "metadata": {
     "scrolled": true
    },
@@ -77,7 +77,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 50,
    "metadata": {},
    "outputs": [
     {
@@ -86,7 +86,7 @@
        "((7, 22, True), -2146.2748427553324)"
       ]
      },
-     "execution_count": 4,
+     "execution_count": 50,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -98,7 +98,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 51,
    "metadata": {},
    "outputs": [
     {
   },
   {
    "cell_type": "code",
-   "execution_count": 7,
+   "execution_count": 52,
    "metadata": {},
    "outputs": [
     {
        "2163"
       ]
      },
-     "execution_count": 7,
+     "execution_count": 52,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
    "source": [
-    "open('2a.plaintext', 'w').write(affine_decipher(ca, m_a, a_a, o_a))"
+    "open('3a.plaintext', 'w').write(affine_decipher(ca, m_a, a_a, o_a))"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 9,
+   "execution_count": 53,
    "metadata": {},
    "outputs": [
     {
        "Counter({'c': 1064, 'd': 1368, 'l': 756, 'm': 566, 'x': 1092})"
       ]
      },
-     "execution_count": 9,
+     "execution_count": 53,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 14,
+   "execution_count": 54,
    "metadata": {},
    "outputs": [
     {
        " ('ll', 45),\n",
        " ('lx', 41),\n",
        " ('md', 36),\n",
-       " ('mx', 27),\n",
        " ('xl', 27),\n",
+       " ('mx', 27),\n",
        " ('lm', 12),\n",
        " ('mc', 5),\n",
        " ('dx', 1)]"
       ]
      },
-     "execution_count": 14,
+     "execution_count": 54,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 37,
+   "execution_count": 55,
    "metadata": {
     "scrolled": true
    },
        "'etoainhsrdlumwycfgpbvkxqz'"
       ]
      },
-     "execution_count": 37,
+     "execution_count": 55,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 51,
+   "execution_count": 56,
    "metadata": {},
    "outputs": [
     {
        "'etoanisrhdlufcmwgybpvkxqz'"
       ]
      },
-     "execution_count": 51,
+     "execution_count": 56,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 45,
+   "execution_count": 77,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "ltrs = 'etoanisrhdlufcmwgybpvkxqz'"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 78,
    "metadata": {},
    "outputs": [
     {
        " 'll',\n",
        " 'lx',\n",
        " 'md',\n",
-       " 'mx',\n",
        " 'xl',\n",
+       " 'mx',\n",
        " 'lm',\n",
        " 'mc',\n",
        " 'dx']"
       ]
      },
-     "execution_count": 45,
+     "execution_count": 78,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 46,
+   "execution_count": 79,
    "metadata": {},
    "outputs": [
     {
        "24"
       ]
      },
-     "execution_count": 46,
+     "execution_count": 79,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 52,
+   "execution_count": 80,
    "metadata": {},
    "outputs": [
     {
        " 'mc': 'X',\n",
        " 'md': 'B',\n",
        " 'ml': 'M',\n",
-       " 'mx': 'P',\n",
+       " 'mx': 'V',\n",
        " 'xc': 'U',\n",
        " 'xd': 'D',\n",
-       " 'xl': 'V',\n",
+       " 'xl': 'P',\n",
        " 'xm': 'E',\n",
        " 'xx': 'O'}"
       ]
      },
-     "execution_count": 52,
+     "execution_count": 80,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 53,
+   "execution_count": 81,
    "metadata": {},
    "outputs": [
     {
        " ...]"
       ]
      },
-     "execution_count": 53,
+     "execution_count": 81,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 54,
+   "execution_count": 82,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "'MHALEATASTIFETHOTSFETNRAFSSETFWTHEYAROLVOTTLEMATHVNFDAUUOOTMOTLARGSTIEETHEHODREATHEITHETINNWSRNITHETOUTAUOLOVALATBTNNPEIUNCETHEHFGERFCEIAUOLDASODPORTOGEYOUEDVBHASOICBMATHNFTTHESFWWNITNYOGIAUNLOORDHASTOLERTEDSUNFTSDEYEOTMNFLDHOPEVEERAREPATOVLEORDMATHATTHELNSSNYVIATORRAOHOPARGIEOLASEDTHOTTHEAUERAMEIEIEODARGHASUNCCFRAUOTANRSOGIAUNLOOIIORGEDTNWLORTYOLSEARYNICOTANROVNFTTHEWLORREDDASWNSATANRNYTINNWSSETTARGOTIOWARTNMHAUHTHEAUERAYELLATASSTALLFRULEOIHNMTHESOPOGETIAVESHODLEOIREDTNDEUAWHEINFIOICBSUNCCFRAUOTANRSOSTHEBHODRNMIATARGNYTHEAINMRHNMEPEIEPEIBOICBHOSATSTIOATNISORDATSEECSLAKELBTNCETHOTNRENICNIENYTHELNUOLTIAVESWENWLETFIREDSNCENRESHEODLNPENICNREBATASOLLTIEOUHEIBVFTTHASOUTTHIEOTEREDTNFRDEICARETHEECWAIESERTAIESBSTECNYSEUFIEUNCCFRAUOTANRTHEUOESOIUAWHEIWEIHOWSCNIETHORINODSHODEROVLEDTHEECWAIETNYFRUTANRSEUFIELBORDATSLNSSMOSODASOSTEITFIRARGTHOTLNSSARTNOPAUTNIBNRTHEVOTTLEYAELDDESEIPEDCNIEIEUNGRATANRTHORATIEUEAPEDWEIHOWSSFETNRAFSREPEIKREMNIWEIHOWSHEYOALEDTNFRDEISTORDTHEUFRRARGNYTHEWLORVFTEATHEIMOBDESWATETHEPAUTNIBOGIAUNLOORDTHERARTHLEGANRIECOAREDARDASGIOUENRHEOIARGTHASREMSULOFDAFSUOESOIOFGFSTFSGEICORAUFSREINECWEINIASSFEDOSEUIETWINULOCOTANRESTOVLASHARGOUAWHEISUHNNLTNDEPELNWOREMSBSTECNYACWEIAOLUAWHEISATMNIKEDARSEUIETYNINPEITMERTBBEOISDEPELNWARGREMCETHNDSTNSEUFIEUNCCFRAUOTANRSOUINSSTHEECWAIESTFDBARGTHEMNIKSNYTHEGIEEKSOGESEFULADORDHBWOTAOORDEPERNLDEIMNIKSYINCORUAERTVOVBLNRTHESUHNNLDEPELNWEDREMMOBSTNSOYEGFOIDUNCCFRAUOTANRSYINCINCESERECAESTHESEREMSBSTECSMEIEMIATTERDNMRORDDASTIAVFTEDARTHEUNDEXNUUFLTNIFCWEIHOWSTHECNSTSTIAUTLBGFOIDEDDNUFCERTAROLLHASTNIBMHERATMOSYAROLLBUNCWLETEDCORBBEOISLOTEITHEECWEINIDNCATAORASSFEDOREXEUFTAPENIDEIMHAUHWIEYOUEDEPEIBUNWBNYTHEUNDEXTHOTATMOSTNVEGFOIDEDVBEPEIBLEGANRTNTHELOSTCORTHEDEYEOTNYTHEAUERAORDTHESFAUADENYVNFDAUUOWEIHOWSWINTEUTEDTHERARTHLEGANRYINCDASSNLFTANROGIAUNLOMOSLOIGELBLEYTTNHASNMRDEPAUESARTHEWINPARUETHNFGHATMOSCODEULEOITNHACTHOTTNIETFIRMNFLDCEOROTVESTDASGIOUEORDOTMNISTDEOTHAROVIEOKMATHTIODATANRTHERARTHIOASEDOREMSTORDOIDTHELEGANRMOSEXALEDARDASGIOUETNERDFIETHEHOIDORDDORGEINFSMNIKNYSFVDFARGTHEUOLEDNRAAARTHEVLEOKMALDEIRESSESNYUOLEDNRAOSFETNRAFSNIDEIEDTHERARTHTNCOIUHTNEVNIOUFCMHAUHTHEBMEIETNCOKETHEAIVOSEYNIIOADSARTNUOLEDNRAOTHEFRSWNKERIEOSNRYNITHEAIEXALEMOSTHOTARTELLAGERUEIEWNITSSFGGESTEDTHOTTHASMOSMHEIETHEBCAGHTYARDTHEAILNSTOQFALOTHNSEMHNMNFLDIEODNRCFSTYNLLNMCBYOATHYFLSLOPETAINMHNYOUESOGIOPETOSKWEIHOWSTHELOIGESTTNDOTEOSHETIOPELSTNUNRUEOLTHEYNFITHUHOWTEINYTHASTIOGAUTOLE'"
+       "'MHALEATASTIFETHOTSFETNRAFSSETFWTHEYAROLPOTTLEMATHPNFDAUUOOTMOTLARGSTIEETHEHODREATHEITHETINNWSRNITHETOUTAUOLOPALATBTNNVEIUNCETHEHFGERFCEIAUOLDASODVORTOGEYOUEDPBHASOICBMATHNFTTHESFWWNITNYOGIAUNLOORDHASTOLERTEDSUNFTSDEYEOTMNFLDHOVEPEERAREVATOPLEORDMATHATTHELNSSNYPIATORRAOHOVARGIEOLASEDTHOTTHEAUERAMEIEIEODARGHASUNCCFRAUOTANRSOGIAUNLOOIIORGEDTNWLORTYOLSEARYNICOTANROPNFTTHEWLORREDDASWNSATANRNYTINNWSSETTARGOTIOWARTNMHAUHTHEAUERAYELLATASSTALLFRULEOIHNMTHESOVOGETIAPESHODLEOIREDTNDEUAWHEINFIOICBSUNCCFRAUOTANRSOSTHEBHODRNMIATARGNYTHEAINMRHNMEVEIEVEIBOICBHOSATSTIOATNISORDATSEECSLAKELBTNCETHOTNRENICNIENYTHELNUOLTIAPESWENWLETFIREDSNCENRESHEODLNVENICNREBATASOLLTIEOUHEIBPFTTHASOUTTHIEOTEREDTNFRDEICARETHEECWAIESERTAIESBSTECNYSEUFIEUNCCFRAUOTANRTHEUOESOIUAWHEIWEIHOWSCNIETHORINODSHODEROPLEDTHEECWAIETNYFRUTANRSEUFIELBORDATSLNSSMOSODASOSTEITFIRARGTHOTLNSSARTNOVAUTNIBNRTHEPOTTLEYAELDDESEIVEDCNIEIEUNGRATANRTHORATIEUEAVEDWEIHOWSSFETNRAFSREVEIKREMNIWEIHOWSHEYOALEDTNFRDEISTORDTHEUFRRARGNYTHEWLORPFTEATHEIMOBDESWATETHEVAUTNIBOGIAUNLOORDTHERARTHLEGANRIECOAREDARDASGIOUENRHEOIARGTHASREMSULOFDAFSUOESOIOFGFSTFSGEICORAUFSREINECWEINIASSFEDOSEUIETWINULOCOTANRESTOPLASHARGOUAWHEISUHNNLTNDEVELNWOREMSBSTECNYACWEIAOLUAWHEISATMNIKEDARSEUIETYNINVEITMERTBBEOISDEVELNWARGREMCETHNDSTNSEUFIEUNCCFRAUOTANRSOUINSSTHEECWAIESTFDBARGTHEMNIKSNYTHEGIEEKSOGESEFULADORDHBWOTAOORDEVERNLDEIMNIKSYINCORUAERTPOPBLNRTHESUHNNLDEVELNWEDREMMOBSTNSOYEGFOIDUNCCFRAUOTANRSYINCINCESERECAESTHESEREMSBSTECSMEIEMIATTERDNMRORDDASTIAPFTEDARTHEUNDEXNUUFLTNIFCWEIHOWSTHECNSTSTIAUTLBGFOIDEDDNUFCERTAROLLHASTNIBMHERATMOSYAROLLBUNCWLETEDCORBBEOISLOTEITHEECWEINIDNCATAORASSFEDOREXEUFTAVENIDEIMHAUHWIEYOUEDEVEIBUNWBNYTHEUNDEXTHOTATMOSTNPEGFOIDEDPBEVEIBLEGANRTNTHELOSTCORTHEDEYEOTNYTHEAUERAORDTHESFAUADENYPNFDAUUOWEIHOWSWINTEUTEDTHERARTHLEGANRYINCDASSNLFTANROGIAUNLOMOSLOIGELBLEYTTNHASNMRDEVAUESARTHEWINVARUETHNFGHATMOSCODEULEOITNHACTHOTTNIETFIRMNFLDCEOROTPESTDASGIOUEORDOTMNISTDEOTHAROPIEOKMATHTIODATANRTHERARTHIOASEDOREMSTORDOIDTHELEGANRMOSEXALEDARDASGIOUETNERDFIETHEHOIDORDDORGEINFSMNIKNYSFPDFARGTHEUOLEDNRAAARTHEPLEOKMALDEIRESSESNYUOLEDNRAOSFETNRAFSNIDEIEDTHERARTHTNCOIUHTNEPNIOUFCMHAUHTHEBMEIETNCOKETHEAIPOSEYNIIOADSARTNUOLEDNRAOTHEFRSWNKERIEOSNRYNITHEAIEXALEMOSTHOTARTELLAGERUEIEWNITSSFGGESTEDTHOTTHASMOSMHEIETHEBCAGHTYARDTHEAILNSTOQFALOTHNSEMHNMNFLDIEODNRCFSTYNLLNMCBYOATHYFLSLOVETAINMHNYOUESOGIOVETOSKWEIHOWSTHELOIGESTTNDOTEOSHETIOVELSTNUNRUEOLTHEYNFITHUHOWTEINYTHASTIOGAUTOLE'"
       ]
      },
-     "execution_count": 54,
+     "execution_count": 82,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 61,
+   "execution_count": 83,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "'MhaLeatastrFethotsFetnRaFssetFWtheYaRoLVottLeMathVnFDaUUootMotLaRGstreethehoDReatherthetrnnWsRnrthetoUtaUoLoVaLatBtnnPerUnCethehFGeRFCeraUoLDasoDPoRtoGeYoUeDVBhasorCBMathnFtthesFWWnrtnYoGraUnLooRDhastoLeRteDsUnFtsDeYeotMnFLDhoPeVeeRaRePatoVLeoRDMathattheLnssnYVratoRRaohoPaRGreoLaseDthottheaUeRaMerereoDaRGhasUnCCFRaUotanRsoGraUnLoorroRGeDtnWLoRtYoLseaRYnrCotanRoVnFttheWLoRReDDasWnsatanRnYtrnnWssettaRGotroWaRtnMhaUhtheaUeRaYeLLatasstaLLFRULeorhnMthesoPoGetraVeshoDLeorReDtnDeUaWhernFrorCBsUnCCFRaUotanRsostheBhoDRnMrataRGnYthearnMRhnMePerePerBorCBhosatstroatnrsoRDatseeCsLaKeLBtnCethotnRenrCnrenYtheLnUoLtraVesWenWLetFrReDsnCenResheoDLnPenrCnReBatasoLLtreoUherBVFtthasoUtthreoteReDtnFRDerCaRetheeCWareseRtaresBsteCnYseUFreUnCCFRaUotanRtheUoesorUaWherWerhoWsCnrethoRrnoDshoDeRoVLeDtheeCWaretnYFRUtanRseUFreLBoRDatsLnssMosoDasostertFrRaRGthotLnssaRtnoPaUtnrBnRtheVottLeYaeLDDeserPeDCnrereUnGRatanRthoRatreUeaPeDWerhoWssFetnRaFsRePerKReMnrWerhoWsheYoaLeDtnFRDerstoRDtheUFRRaRGnYtheWLoRVFteatherMoBDesWatethePaUtnrBoGraUnLooRDtheRaRthLeGanRreCoaReDaRDasGroUenRheoraRGthasReMsULoFDaFsUoesoroFGFstFsGerCoRaUFsRerneCWernrassFeDoseUretWrnULoCotanRestoVLashaRGoUaWhersUhnnLtnDePeLnWoReMsBsteCnYaCWeraoLUaWhersatMnrKeDaRseUretYnrnPertMeRtBBeorsDePeLnWaRGReMCethnDstnseUFreUnCCFRaUotanRsoUrnsstheeCWarestFDBaRGtheMnrKsnYtheGreeKsoGeseFULaDoRDhBWotaooRDePeRnLDerMnrKsYrnCoRUaeRtVoVBLnRthesUhnnLDePeLnWeDReMMoBstnsoYeGForDUnCCFRaUotanRsYrnCrnCeseReCaestheseReMsBsteCsMereMratteRDnMRoRDDastraVFteDaRtheUnDeXnUUFLtnrFCWerhoWstheCnststraUtLBGForDeDDnUFCeRtaRoLLhastnrBMheRatMosYaRoLLBUnCWLeteDCoRBBeorsLotertheeCWernrDnCataoRassFeDoReXeUFtaPenrDerMhaUhWreYoUeDePerBUnWBnYtheUnDeXthotatMostnVeGForDeDVBePerBLeGanRtntheLostCoRtheDeYeotnYtheaUeRaoRDthesFaUaDenYVnFDaUUoWerhoWsWrnteUteDtheRaRthLeGanRYrnCDassnLFtanRoGraUnLoMosLorGeLBLeYttnhasnMRDePaUesaRtheWrnPaRUethnFGhatMosCoDeULeortnhaCthottnretFrRMnFLDCeoRotVestDasGroUeoRDotMnrstDeothaRoVreoKMathtroDatanRtheRaRthroaseDoReMstoRDorDtheLeGanRMoseXaLeDaRDasGroUetneRDFrethehorDoRDDoRGernFsMnrKnYsFVDFaRGtheUoLeDnRaaaRtheVLeoKMaLDerRessesnYUoLeDnRaosFetnRaFsnrDereDtheRaRthtnCorUhtneVnroUFCMhaUhtheBMeretnCoKethearVoseYnrroaDsaRtnUoLeDnRaotheFRsWnKeRreosnRYnrtheareXaLeMosthotaRteLLaGeRUereWnrtssFGGesteDthotthasMosMheretheBCaGhtYaRDthearLnstoQFaLothnseMhnMnFLDreoDnRCFstYnLLnMCBYoathYFLsLoPetarnMhnYoUesoGroPetosKWerhoWstheLorGesttnDoteoshetroPeLstnUnRUeoLtheYnFrthUhoWternYthastroGaUtoLe'"
+       "'while it is true that suetonius setup the final battle with boudicca at watling street he had neither the troops nor the tactical ability to overcome the huge numerical disadvantage faced by his army without the support of agricola and his talented scouts defeat would have been inevitable and with it the loss of britannia having realised that the iceni were reading his communications agricola arranged to plant false information about the planned disposition of troops setting a trap into which the iceni fell it is still unclear how the savage tribes had learned to decipher our army s communications as they had no writing of their own however every army has its traitors and it seems likely to me that one or more of the local tribespeople turned someones head love or money it is all treachery but this act threatened to undermine the empires entire system of secure communication the caesar cipher perhaps more than roads had enabled the empire to function securely and its loss was a disaster turning that loss into a victory on the battlefield deserved more recognition than it received perhaps suetonius never knew or perhaps he failed to understand the cunning of the plan but either way despite the victory agricola and the ninth legion remained in disgrace on hearing this news claudius caesar augustus germanicus nero emperor issued a secret proclamation establishing a cipher school to develop a new system of imperial ciphers it worked in secret for over twenty years developing new methods to secure communications across the empire studying the works of the greeks ages euclid and hypatia and even older works from ancient babylon the school developed new ways to safeguard communications from rome s enemies these new systems were written down and distributed in the codex occult orum perhaps the most strictly guarded document in all history when it was finally completed many years later the emperor domitian issued an executive order which prefaced every copy of the codex that it was to be guarded by every legion to the last man the defeat of the iceni and the suicide of boudicca perhaps protected the ninth legion from dissolution agricola was largely left to his own devices in the province though it was made clear to him that to return would mean at best disgrace and at worst death in a break with tradition the ninth raised a new standard the legion was exiled in disgrace to endure the hard and dangerous work of subduing the caledon ii in the bleak wildernesses of caledonia suetonius ordered the ninth to march toe bora cum which they were to make their base for raids into caledonia the unspoken reason for their exile was that intelligence reports suggested that this was where they might find their lost aquila those who would read on must follow my faithful slave tiro who faces a grave task perhaps the largest to date a she travels to conceal the fourth chapter of this tragic tale'"
       ]
      },
-     "execution_count": 61,
+     "execution_count": 83,
      "metadata": {},
      "output_type": "execute_result"
     }
     "tr = {}\n",
     "tr['E'] = 'e'\n",
     "tr['T'] = 't'\n",
-    "tr['O'] = 'o'\n",
-    "tr['A'] = 'a'\n",
+    "tr['O'] = 'a'\n",
+    "tr['A'] = 'i'\n",
     "tr['I'] = 'r'\n",
-    "tr['N'] = 'n'\n",
     "tr['H'] = 'h'\n",
     "tr['S'] = 's'\n",
+    "tr['M'] = 'w'\n",
+    "tr['P'] = 'b'\n",
+    "tr['L'] = 'l'\n",
+    "tr['Y'] = 'f'\n",
+    "tr['R'] = 'n'\n",
+    "tr['G'] = 'g'\n",
+    "tr['F'] = 'u'\n",
+    "tr['B'] = 'y'\n",
+    "tr['V'] = 'v'\n",
+    "tr['N'] = 'o'\n",
+    "tr['D'] = 'd'\n",
+    "tr['U'] = 'c'\n",
+    "tr['W'] = 'p'\n",
+    "tr['C'] = 'm'\n",
+    "tr['K'] = 'k'\n",
+    "tr['X'] = 'x'\n",
+    "tr['Q'] = 'q'\n",
+    "\n",
     "# english: etoainhs rdlumwycfgpbvkxqz\n",
     "# texts: etoanisrhdlufcmwgybpvkxqz\n",
     "\n",
     "\n",
-    "trans = ''.maketrans(tr)\n",
-    "scbpt.translate(trans)"
+    "tt = ''.maketrans(tr)\n",
+    "wcat(segment(scbpt.translate(tt)))\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 84,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "2922"
+      ]
+     },
+     "execution_count": 84,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "open('3b.plaintext', 'w').write(wcat(segment(scbpt.translate(tt))))"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 85,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{'A': 'i',\n",
+       " 'B': 'y',\n",
+       " 'C': 'm',\n",
+       " 'D': 'd',\n",
+       " 'E': 'e',\n",
+       " 'F': 'u',\n",
+       " 'G': 'g',\n",
+       " 'H': 'h',\n",
+       " 'I': 'r',\n",
+       " 'K': 'k',\n",
+       " 'L': 'l',\n",
+       " 'M': 'w',\n",
+       " 'N': 'o',\n",
+       " 'O': 'a',\n",
+       " 'P': 'b',\n",
+       " 'Q': 'q',\n",
+       " 'R': 'n',\n",
+       " 'S': 's',\n",
+       " 'T': 't',\n",
+       " 'U': 'c',\n",
+       " 'V': 'v',\n",
+       " 'W': 'p',\n",
+       " 'X': 'x',\n",
+       " 'Y': 'f'}"
+      ]
+     },
+     "execution_count": 85,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "tr"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 86,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{'cc': 'n',\n",
+       " 'cd': 'o',\n",
+       " 'cl': 'm',\n",
+       " 'cm': 'p',\n",
+       " 'cx': 'l',\n",
+       " 'dc': 's',\n",
+       " 'dd': 't',\n",
+       " 'dl': 'r',\n",
+       " 'dm': 'u',\n",
+       " 'dx': 'q',\n",
+       " 'lc': 'h',\n",
+       " 'ld': 'i',\n",
+       " 'll': 'g',\n",
+       " 'lm': 'k',\n",
+       " 'lx': 'f',\n",
+       " 'mc': 'x',\n",
+       " 'md': 'y',\n",
+       " 'ml': 'w',\n",
+       " 'mx': 'v',\n",
+       " 'xc': 'c',\n",
+       " 'xd': 'd',\n",
+       " 'xl': 'b',\n",
+       " 'xm': 'e',\n",
+       " 'xx': 'a'}"
+      ]
+     },
+     "execution_count": 86,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "fm = {pr[1]: tr[pr[0].upper()] for pr in zip(ltrs, prs)}\n",
+    "fm"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 87,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "order = 'xlcdm'"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 88,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "abcde\n",
+      "fghik\n",
+      "lmnop\n",
+      "qrstu\n",
+      "vwxy\n"
+     ]
+    }
+   ],
+   "source": [
+    "for c in order:\n",
+    "    for r in order:\n",
+    "        if c+r != 'mm':\n",
+    "            print(fm[c+r], end='')\n",
+    "    print('')"
    ]
   },
   {
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.5.2"
+   "version": "3.5.3"
   }
  },
  "nbformat": 4,
diff --git a/2017/3b.plaintext b/2017/3b.plaintext
new file mode 100644 (file)
index 0000000..7ae5190
--- /dev/null
@@ -0,0 +1 @@
+while it is true that suetonius setup the final battle with boudicca at watling street he had neither the troops nor the tactical ability to overcome the huge numerical disadvantage faced by his army without the support of agricola and his talented scouts defeat would have been inevitable and with it the loss of britannia having realised that the iceni were reading his communications agricola arranged to plant false information about the planned disposition of troops setting a trap into which the iceni fell it is still unclear how the savage tribes had learned to decipher our army s communications as they had no writing of their own however every army has its traitors and it seems likely to me that one or more of the local tribespeople turned someones head love or money it is all treachery but this act threatened to undermine the empires entire system of secure communication the caesar cipher perhaps more than roads had enabled the empire to function securely and its loss was a disaster turning that loss into a victory on the battlefield deserved more recognition than it received perhaps suetonius never knew or perhaps he failed to understand the cunning of the plan but either way despite the victory agricola and the ninth legion remained in disgrace on hearing this news claudius caesar augustus germanicus nero emperor issued a secret proclamation establishing a cipher school to develop a new system of imperial ciphers it worked in secret for over twenty years developing new methods to secure communications across the empire studying the works of the greeks ages euclid and hypatia and even older works from ancient babylon the school developed new ways to safeguard communications from rome s enemies these new systems were written down and distributed in the codex occult orum perhaps the most strictly guarded document in all history when it was finally completed many years later the emperor domitian issued an executive order which prefaced every copy of the codex that it was to be guarded by every legion to the last man the defeat of the iceni and the suicide of boudicca perhaps protected the ninth legion from dissolution agricola was largely left to his own devices in the province though it was made clear to him that to return would mean at best disgrace and at worst death in a break with tradition the ninth raised a new standard the legion was exiled in disgrace to endure the hard and dangerous work of subduing the caledon ii in the bleak wildernesses of caledonia suetonius ordered the ninth to march toe bora cum which they were to make their base for raids into caledonia the unspoken reason for their exile was that intelligence reports suggested that this was where they might find their lost aquila those who would read on must follow my faithful slave tiro who faces a grave task perhaps the largest to date a she travels to conceal the fourth chapter of this tragic tale
\ No newline at end of file