Updated for challenge 9
[cipher-tools.git] / 2018 / 2018-challenge6.ipynb
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "metadata": {},
7 "outputs": [],
8 "source": [
9 "import os,sys,inspect\n",
10 "currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n",
11 "parentdir = os.path.dirname(currentdir)\n",
12 "sys.path.insert(0,parentdir) "
13 ]
14 },
15 {
16 "cell_type": "code",
17 "execution_count": 25,
18 "metadata": {},
19 "outputs": [],
20 "source": [
21 "from cipher.caesar import *\n",
22 "from cipher.affine import *\n",
23 "from cipher.keyword_cipher import *\n",
24 "from cipher.vigenere import *\n",
25 "from cipher.playfair import *\n",
26 "from cipher.column_transposition import *\n",
27 "from support.text_prettify import *\n",
28 "from support.plot_frequency_histogram import *"
29 ]
30 },
31 {
32 "cell_type": "code",
33 "execution_count": 34,
34 "metadata": {},
35 "outputs": [],
36 "source": [
37 "ca = open('6a.ciphertext').read()\n",
38 "cb = open('6b.ciphertext').read()\n",
39 "scb = sanitise(cb)"
40 ]
41 },
42 {
43 "cell_type": "code",
44 "execution_count": 6,
45 "metadata": {},
46 "outputs": [
47 {
48 "data": {
49 "text/plain": [
50 "8197"
51 ]
52 },
53 "execution_count": 6,
54 "metadata": {},
55 "output_type": "execute_result"
56 }
57 ],
58 "source": [
59 "history_words = [w.strip() for w in open('history-words.txt')]\n",
60 "len(history_words)"
61 ]
62 },
63 {
64 "cell_type": "code",
65 "execution_count": 7,
66 "metadata": {},
67 "outputs": [
68 {
69 "data": {
70 "text/plain": [
71 "('nautilus', <KeywordWrapAlphabet.from_last: 2>, -2791.895864772198)"
72 ]
73 },
74 "execution_count": 7,
75 "metadata": {},
76 "output_type": "execute_result"
77 }
78 ],
79 "source": [
80 "(key_a, wrap_a), score_a = keyword_break_mp(ca)\n",
81 "key_a, wrap_a, score_a"
82 ]
83 },
84 {
85 "cell_type": "code",
86 "execution_count": 8,
87 "metadata": {},
88 "outputs": [
89 {
90 "name": "stdout",
91 "output_type": "stream",
92 "text": [
93 "it was dark and dusty in the shadow archive but atleast i had found it the shelves marched off into\n",
94 "the gloom and most of them were empty though there was the occasional box of papers marked sa which\n",
95 "had clearly been forgotten in the move they would be interesting to read later but nothing in them\n",
96 "looked important enough to have excited my co conspirator whoever that might be it would have been\n",
97 "easy to get discouraged but i needed to recover the lidar so i carried on searching for the chimney\n",
98 "i eventually found it at the back of the stacks but there was no sign of the lidar or of any\n",
99 "disturbance to suggest it had fallen that far so i guessed it might have got caught on a ledge\n",
100 "higher up fortunately the chimney was fairly wide but not so wide that i couldnt bridge it and all\n",
101 "those hours on the climbing wall paid off as i climbed up looking for the lost machine as i\n",
102 "suspected it had caught on one of the ledges designed to catch rain so i made ready to lower it back\n",
103 "down but as i moved loose bricks to steady myself part of the inner wall collapsed and to my\n",
104 "amazement i found myself staring into a control room it was very jules verne and wouldnt have looked\n",
105 "out of place on the bridge of the nautilus it must have been cutting edge technology once all brass\n",
106 "and polished instruments there was a map on the wall covered in small bulbs that i assumed would\n",
107 "have lit up to signify activity and a bank of fine nineteenth century telegraph machines in polished\n",
108 "walnut unless i was mistaken i had found douglas blacks command centre under a large circular oak\n",
109 "table in the centre of the room there was a filing system with drawers containing maps of every\n",
110 "nation and the table could be turned like a restaurant lazy susan the walls were lined with\n",
111 "brassbound ledgers and folders marked with what looked like mission code names in amongst them was\n",
112 "the most amazing find blacks codebook it contained a number of keys and best of all a list of\n",
113 "ciphers and when and how they should be used it would be worth a fortune on the bibliophile black\n",
114 "market but i didnt feel like selling it harry might be interested if only for historical reasons but\n",
115 "if not then this would find a home in my own private collection i took a seat by the telegraph and\n",
116 "put my feet up opening the codebook at random to read as with the three emperors operation it maybe\n",
117 "necessary to enhance operational security during the operation itself in that case we moved from\n",
118 "purely letter substitution cryptograms to transposition ciphers and at the urging of baron playfair\n",
119 "other more complicated ciphers like the vi genere and playfair ciphers and variants upon them i was\n",
120 "completely immersed in what i was reading and then it hit me\n"
121 ]
122 }
123 ],
124 "source": [
125 "print(lcat(tpack(segment(sanitise(keyword_decipher(ca, key_a, wrap_a))))))"
126 ]
127 },
128 {
129 "cell_type": "code",
130 "execution_count": 43,
131 "metadata": {},
132 "outputs": [
133 {
134 "data": {
135 "text/plain": [
136 "2704"
137 ]
138 },
139 "execution_count": 43,
140 "metadata": {},
141 "output_type": "execute_result"
142 }
143 ],
144 "source": [
145 "open('6a.plaintext', 'w').write(lcat(tpack(segment(sanitise(keyword_decipher(ca, key_a, wrap_a))))))"
146 ]
147 },
148 {
149 "cell_type": "code",
150 "execution_count": 10,
151 "metadata": {},
152 "outputs": [
153 {
154 "data": {
155 "text/plain": [
156 "('a', -2672.4820858271923)"
157 ]
158 },
159 "execution_count": 10,
160 "metadata": {},
161 "output_type": "execute_result"
162 }
163 ],
164 "source": [
165 "key_b, score_b = vigenere_frequency_break(sanitise(cb))\n",
166 "key_b, score_b"
167 ]
168 },
169 {
170 "cell_type": "code",
171 "execution_count": 23,
172 "metadata": {},
173 "outputs": [
174 {
175 "data": {
176 "text/plain": [
177 "('a', -2672.4820858271933)"
178 ]
179 },
180 "execution_count": 23,
181 "metadata": {},
182 "output_type": "execute_result"
183 }
184 ],
185 "source": [
186 "key_b, score_b = vigenere_frequency_break(sanitise(cat(reversed(cb))))\n",
187 "key_b, score_b"
188 ]
189 },
190 {
191 "cell_type": "code",
192 "execution_count": 11,
193 "metadata": {},
194 "outputs": [
195 {
196 "data": {
197 "text/plain": [
198 "('abd', <KeywordWrapAlphabet.from_a: 1>, -9171.241735262733)"
199 ]
200 },
201 "execution_count": 11,
202 "metadata": {},
203 "output_type": "execute_result"
204 }
205 ],
206 "source": [
207 "(key_b, wrap_b), score_b = keyword_break_mp(sanitise(cb), wordlist=history_words, fitness=Ptrigrams)\n",
208 "key_b, wrap_b, score_b"
209 ]
210 },
211 {
212 "cell_type": "code",
213 "execution_count": 12,
214 "metadata": {},
215 "outputs": [
216 {
217 "name": "stderr",
218 "output_type": "stream",
219 "text": [
220 "/usr/local/lib/python3.6/dist-packages/matplotlib/figure.py:459: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure\n",
221 " \"matplotlib is currently using a non-GUI backend, \"\n"
222 ]
223 },
224 {
225 "data": {
226 "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbAAAAEmCAYAAAADccV0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAEwtJREFUeJzt3XvMZHV9x/H3R6BegMrtkSKgj9qtLdYIuCIWTVC8IGjAFCneQKNZrRC1FRPQGgmRZK23aFKpoASsqGAVwYIXulABFWF3uS0gspWlsEFY0SJIRC7f/jFnywDLzszzzOyzv33er2TynHPm/J7f98ztM78zZ86kqpAkqTVPmOsCJEmaCQNMktQkA0yS1CQDTJLUJANMktQkA0yS1CQDTJLUJANMktQkA0yS1CQDTJLUpM3nugCAHXbYoaanp+e6DEnSRmDZsmW/rqqpQettFAE2PT3N0qVL57oMSdJGIMnNw6znLkRJUpMMMElSkwwwSVKTDDBJUpMMMElSkwwwSVKTDDBJUpMMMElSkwwwSVKTDDBJUpM2ilNJSZI2TtPHnDv0uqsWHzjBSh7LEZgkqUkGmCSpSQaYJKlJBpgkqUkGmCSpSQaYJKlJBpgkqUkGmCSpSQaYJKlJBpgkqUkGmCSpSQaYJKlJBpgkqUkGmCSpSQaYJKlJBpgkqUkGmCSpSQaYJKlJBpgkqUkGmCSpSQaYJKlJAwMsya5JLkxyXZJrk7y/W35cktVJruwuB/S1OTbJyiQ3JHnNJDdAkjQ/bT7EOg8AH6yq5Um2BpYlOb+77rNV9an+lZPsBhwGPA94OvCfSf6iqh4cZ+GSpPlt4Aisqm6rquXd9N3A9cDO62lyEPCNqrqvqm4CVgJ7jaNYSZLWGukzsCTTwB7Az7pFRyW5OskpSbbtlu0M3NLX7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VHfiZNsV1V/TO9gmv+tqgeH7Oti4CPAT7vb5w8M8WJSVZcnOYfeqO12eruhRt31NJLuvjgB+FGSB+l9nvn2Cfd5f5Lj6X0+uBr4+RBtlic5A7gKuIPeuUs3Zs8HPpnkIeB+4O8n2Vl3+5xK7zaF3i/KXzHBLr8PvCfJ9fSeW6Ps7pyxqrqzO0BpBfC9qvrQEG2uS/JPwA/TO6LzfuBI4OYJl7tOnoljArp34Muras7emUxKkmngP6pqJkdmPgFYDryxqm4cc2nr6m+rqronvaMkLwIWVdXySfcracPYZHchzpVud8dP6R3FqE6S3egd7bZkQ4RX56Tug+blwLcML2nT4ghMktQkR2CSpCYZYJKkJhlgkqQmGWCSpCYZYJKkJhlgkqQm/R+8klyBllz/VQAAAABJRU5ErkJggg==\n",
227 "text/plain": [
228 "<Figure size 432x288 with 1 Axes>"
229 ]
230 },
231 "metadata": {},
232 "output_type": "display_data"
233 }
234 ],
235 "source": [
236 "fc = collections.Counter(sanitise(cb))\n",
237 "plot_frequency_histogram(fc, sort_key=fc.get)"
238 ]
239 },
240 {
241 "cell_type": "code",
242 "execution_count": 16,
243 "metadata": {},
244 "outputs": [
245 {
246 "data": {
247 "text/plain": [
248 "(('realisation', <KeywordWrapAlphabet.from_largest: 3>, {'j': 'i'}, 'x', True),\n",
249 " -10108.573645429131)"
250 ]
251 },
252 "execution_count": 16,
253 "metadata": {},
254 "output_type": "execute_result"
255 }
256 ],
257 "source": [
258 "key, score = playfair_break_mp(cb, fitness=Ptrigrams, wordlist=history_words)\n",
259 "key, score"
260 ]
261 },
262 {
263 "cell_type": "code",
264 "execution_count": 17,
265 "metadata": {},
266 "outputs": [
267 {
268 "data": {
269 "text/plain": [
270 "'ulalblueoefurkekcglaireulondtunttlahrtrlurlhlolqegaemafgpysnanxtpllzqdagtgovuouavtkslafyxlleqrhsmawkakutekreksowwkmralovedsuaeibkenxesglwnfustslnueltlaskakagdsaksacaweniduarusfrbstliwpuolooglttrdeorvlnlmymahbdetsgtorpsluaggaxriqiahtruuofiaeulntzqirsosootleunfofohaltautrisrgelenwnmamlxankiseaovtfkwrilzwrrhrknwulorfifyxllenmlsauussnsmekobulzroglaldtukermtlwslaenulraylitkwnlmovknwwlrirmekirtsriklorsonmsolgtarzexoctlbrrctsksdpraoeerownrtsurtlsnvbskwlxrlakeoerasnasksrqnwlrlusinddngeaeaurbsotarkskabolrmerxhenuttsaestbesoanlctasrsoksnvkeawksdiforlelfobtovntazytkslttormstirformselrrtuaouaboladlrlhkoasolnpskowwlmeksriatwkbanctakrakeuidoscnirrkarcfawoebrrweravnslttsbmselrsmtrkoeuurrmristwebarmrcstbtakksriralxuektotcotaltocrcsmekirasrwkeoymtxtrmvwsuorlektcaotcapltsnlctxtrmrmscuoawriaswkbomxkseskenormxcirqmrtutgrekrnnmrmekoebhsksnulistagrsusorikerbsuurrcazarwrtsercrulsorilneyrisuoezfltlrkstxfalbnmagnadedmzlfodmrahneocadsdrawaftswrnarlqlteksrkekmsfpnbkbogeourulqibqnbcaliforafyxlleurahmaolbdoynoluidaglulwsatxeqzcosazmvopkvsarekrsuurqsgeoyfuawdhtlasclwkglowrwrmululksoveicincwnasrkolqderkasonctaqrrikbeouscaakeuidtlplmoaclblsmaqurtuddbehrmxsfolomoabovakwnucmarikeaklstusiruovrxulankayslteuksrdkcrnololksbaretkroeravepurksowermsvxinoncoluerdcqbeustdtsoanissasexmsaketztruenumvbfrqrprwrlanysyrakkeosulrkurgogeovotueoryebterksesexktntmbryelarowekplaomslklgndtlniftfurqseklulqlfeloroobkttaxoegcadnnetxnakspflwelldrheiekoezfmylzifsledclfptiisovristekpsiquaakhvhoirdnrkeklseuitntorlsicusfoldtdlgirlkovabiocarkowkaasnmtseslfrksaawgebofulhrzuagofuvtksrqsolrkelaarciftktawtlxaoclhlmawavndksndkeasbkaqzcsleorcktlsrtoiruolksxaatowmdkaulhfrisndysaeriboerhiclglugefteolwrkkteriadsektlisohrlomoqtdpdulunotadidslnttlaqrtkevfrkutdoswiearntrnoreseokabqvkgezeaylravlctssuermrpfynilmozqdhowtapbglgeaekttriadreklktuabioeklrpraberirksusexuentgcrfkeekirstoteceotalggldkaeulkentrbnckaekltrqzcalktawilkwrwdlfanoeamxtgdeiekedwonaoneldnecabrrutgruuosmsnirovolluiomxsumslssiideldnuldlegnriryekeclotvxenlurqndmdlhrnirotlpeoaotrnccabrrutgruuotomaofdiawavxawkbanctakrakeuudulieusibcaitaoweakktunynayultlowxoatpfuesmsnurftserllxsooerkstbpsetdulkdfdotirftrlatftuooluenktora'"
271 ]
272 },
273 "execution_count": 17,
274 "metadata": {},
275 "output_type": "execute_result"
276 }
277 ],
278 "source": [
279 "playfair_decipher(cb, 'realisation', padding_replaces_repeat=True, wrap_alphabet=KeywordWrapAlphabet.from_largest)"
280 ]
281 },
282 {
283 "cell_type": "code",
284 "execution_count": 18,
285 "metadata": {},
286 "outputs": [
287 {
288 "data": {
289 "text/plain": [
290 "(('resurrection', <KeywordWrapAlphabet.from_a: 1>, {'j': 'i'}, 'x', True),\n",
291 " -10095.318678614976)"
292 ]
293 },
294 "execution_count": 18,
295 "metadata": {},
296 "output_type": "execute_result"
297 }
298 ],
299 "source": [
300 "key, score = playfair_break_mp(cat(reversed(cb)), fitness=Ptrigrams, wordlist=history_words)\n",
301 "key, score"
302 ]
303 },
304 {
305 "cell_type": "code",
306 "execution_count": 19,
307 "metadata": {},
308 "outputs": [
309 {
310 "data": {
311 "text/plain": [
312 "'dwoikntanoouauisewaurciodfsqtosavrgdiadcnaoaznewvrauoernfatamkiswfovuitomwxgselwlsarsmsrwibuortctofnatlscdsiboebruifsvswnhgiinoioueouseocfwiboresmanpiiorcemkuqoosdaotikxviosdirdlrcmeeaohtosotnhncstuafrohicnotnoxmrcrnfaoueouseocfwikihokismyuszirtcczushiqiuydiohwrurteswlweddydaiurislbofcnsirtoiqqsoddosianbrioiarcriirdkbhnstaziorabrccibeqdwericnbexslurithkerelwiqaeoddgsiovkfndoztexgmkcaciroaidssvwemwelaedzgfslanrvocemnswdtckrfmsxdcgvirerlouinsuthnfsiosetoofsapsozewfxscuiritfkecilwdcwuanauaeotdoducenabucistomrncrgktoslqoovisifabnoeoncertulwdranutdyloaztsirosabossvswqnkubiifuiswlwauudwddeirweoadaabexunegtiwtkuunefaeswstdcgurvaimntsslovdcwicnbexmlurcdosahoigordutuocnssratturidcsorcxftvlstineagriiacrxmscrskmsdzcutdpwnmynpnarictcehotnwumkabmixikisowieafwsilwfecoonqenltoulvrdaunaupeuiosdoluafsmipriovwdtnwkbgnslwzirvabcieudloctaioxmaeegoedctoaoirlskwtyimewwrdqdahufzestareyeirstihvrstscimoaasiaatfgbdciotibyuepxvafciovaboeqksvcicowlicebabnonoemlrhtabatiutyslimtoztxmeocsxstulsircrinbnnvlsxmbeozonigtxacbvshfnerwaintubsiwzoipuihnatlswioranzacradsibooaslcifpnodctsnvboudctxmabtotoacwrovodrusdtsuikfswunoyaecgoerocdicstzdpofzowaodyltxistwuotiehnotuyoyhsnoinksoentnzgmdwigetwioxgfentooeangezaoxkmafridcabivnlewmirwaiidswthtfwianumdwoqignwoqczmiiemnbsdixiabweiunpnarocrldpucroatordciairwwdowdroerofcircroarotdsisctornbacbnariacmnemritdsxerqgrcilacuyirrvabhiefrutscrswoutracacixvlupaiipwiiowilwntocrovwacixtmoyirwrtsrcrifadrbiiusiibiolwtazndwcrablseuiadracebariacracoeatokrefawevrgbaiiunrsvciwrcfnaswfbwddcrcobaohnatlscdsiboebruiscrabtquwovbapwnotsokkuwefsnobeuotierwevracigrciaacoiiuabiyownsxmeuigtnewignhabswirxuaboarxsidsimoacuiaiqaisxikkxciacnobebadcsioafcitiqaesooscsotwevndaabtsrndwnairdetzuwbaghrnuioeaimeovcinadwfoabaidrcfuibiziwtsidooamnoaoculcraircriaccruwvndzozupursrogdwtoikderkuiacirxshodegetwtoferifarnorittumnntnzgmpdoctovndccerwwncruruaxmqiscknifnqinnviktndtscreitiuskigigsentiooaoarcndnstoiqpdoueormkenetzeiieotagocsuaiczbcinmyupuvocczreiugeonoupvetiafcgteotihnikswiwabstdhslsltsuitnesutiaunnvodrvxnirbuiqrozcxmedcaruovabicrisxlsruinkvadntnzgmdeabextiouxmusiefpwnipiximrndmhfiniqealnonkuoeewerksuinsxsosonatrcdehbridcunnatasbedto'"
313 ]
314 },
315 "execution_count": 19,
316 "metadata": {},
317 "output_type": "execute_result"
318 }
319 ],
320 "source": [
321 "playfair_decipher(cat(reversed(cb)), 'resurrection', padding_replaces_repeat=True, wrap_alphabet=KeywordWrapAlphabet.from_a)"
322 ]
323 },
324 {
325 "cell_type": "code",
326 "execution_count": 20,
327 "metadata": {},
328 "outputs": [
329 {
330 "data": {
331 "text/plain": [
332 "(('resignation', <KeywordWrapAlphabet.from_largest: 3>, {'j': 'i'}, 'x', True),\n",
333 " -9896.15193568302)"
334 ]
335 },
336 "execution_count": 20,
337 "metadata": {},
338 "output_type": "execute_result"
339 }
340 ],
341 "source": [
342 "key, score = playfair_break_mp(cb, fitness=Ptrigrams)\n",
343 "key, score"
344 ]
345 },
346 {
347 "cell_type": "code",
348 "execution_count": 22,
349 "metadata": {},
350 "outputs": [
351 {
352 "data": {
353 "text/plain": [
354 "'orpebiosanrugcaschepgrsonuiytiotarskrersesiknupfefcentrhpcaopayakapoqssfahmtrtipxeduepfywoeofgknntwlslitasledustwlcupemtewsmcegisaiosnypxoruatrktgoearinlslshdniduscswmaueipservgdatsgvprtnuthraerweetvivomyntgbwetahaetburosffswnogekmrserteqceorotisgrauauuteogtbtbtksrapiergnrfoemaxontloftomgnecmtablwrgpowreggcoxoreteqfywoeoifkrpimsaoufasmxoryrthepoctisaucarxnepmaorlcbogalwvotwzcoxwirgucasgrtarglietauifaupyairyeasxardgrctadudplcanelstemtaesaraohfudwiwnepsaanlcaoindugfoxsrrongiyyifecepigdauaigcudsbunucelxkmaittaceatbeaupaicaixrauduixsaswdueubtrsoebtdemtotsyvaduratuucatgrbtucnssrreiptrsbuntpsrikdsinunwpudstwilndurgiawlbsodaicgslsoueuadogrgcclhsswandgrwelsvoaratacfnssruferdssoesucrgatdabsucrcatdesldurglcowoslautxsairasxrcufasgrinrwsatvpnyaucvwsmeteolacsutcskatavolvyaucucndrtswrginwlxmtcdusnsaouucxcgrfqreitfrasmeifucasanbgudaoorgnaifrsmaurgsagdsmesrcsyclwrtaelcroraurgovcargsmanzirasrduaycmibifsfapweltopbtltlcminacsfncnswmctawraprsfpxadugcasfumkidfbthnaesorgoqzidcssgbtlcfywoeoesskntunbdtvourouesfroiwniayrpzeuasydztkcznilecgsmeszgfetvruswdkarinciwlypstrwucorordumtneirodxoingcunqsellsauodaifgrgfbnamscsslsouearkatwscibkrntgyreuidbkbucynbtnutwsbmtslxousntrgsaslkrtingsemtnworpalsnrrasoduncrlmeunundubslealteelsvkqesdustelfuvxqauoxsroeldczqsoatfaaupagnninsctnisaazerostgdzhegfqcrwrspanrwkslsauaorgceshtfemtutosetacdeeldusnealaotfckwoeclstaskatyfuilpyiyaraqbarugfnsliorfpwcnutemxlaaixtefcsyiamayapdukmiwoeocegneasanzimypoqerkewcimkaggnmtrgatasbuogipslkvdmgryigcaskrsogaotetkrrimsbtocafpygrilmtsbnocsgcstlsiniftasnokgcniswfexmruikryiphtruxedugfausrsaepclirbalaswarftsxikolswsviyduiysainbfspzerknarclakrreonseunduftiasttllsorkfrgaodynielgianegripyrofebanaiwgclaelekfnasargnmdrswttqafpdorgtuttpuerkotarspresavfgcitdtnxenclotmeetsnnalsqzzcfeyemwsrsvictasmelcukmyogstwisdkstaifdypfecelaerekcnasiltisbnoassrcqsbelgrdumseaosothckcsaasgratutnmnaaipyypdlceorsaotgdodlsasragfzepelaswgslwrwcocmouectcahweensadwuotyamocamcsdgseahsertufaogrmtunronotcsmfukrngueoeyiorcoefemgracsaciutvxmarogfiytlikmegrutaknatyerodcsdgseahserttunttbeuswsvftwlbsodaicgslsouiorenmsgicsgatydasllagtyomworarstxtiakmosufaoesbansrsowauangcatdfnsaforldihutgrbarsiabartunosomtulc'"
355 ]
356 },
357 "execution_count": 22,
358 "metadata": {},
359 "output_type": "execute_result"
360 }
361 ],
362 "source": [
363 "playfair_decipher(cb, 'resignation', padding_replaces_repeat=True, wrap_alphabet=KeywordWrapAlphabet.from_largest)"
364 ]
365 },
366 {
367 "cell_type": "code",
368 "execution_count": 36,
369 "metadata": {},
370 "outputs": [
371 {
372 "data": {
373 "text/plain": [
374 "(3, -5512.824261230463)"
375 ]
376 },
377 "execution_count": 36,
378 "metadata": {},
379 "output_type": "execute_result"
380 }
381 ],
382 "source": [
383 "key, score = scytale_break_mp(scb)\n",
384 "key, score"
385 ]
386 },
387 {
388 "cell_type": "code",
389 "execution_count": 37,
390 "metadata": {},
391 "outputs": [
392 {
393 "data": {
394 "text/plain": [
395 "'nitaeeieafueeirniagfloigusosifiiaesehthiasrtrigouirebreeainhikadsaynahouhndarsslnornnadneorbltporlncieeyslyarothsiulotntlifuyateaeorsntfiwnsoteatlsebhvltlrtteufcasnehnhvtoacneetteegnansowtohrnteosnmrtnltehrcroeigfelgtsarettestshttabcmeltwdetbteetkowsiwneonwhtneoddrtadhsbeohtrtioitrsseivtbieyesynhwrpoaynesdoedvlpteepfutnusedlyarocnigjyokninweesunnbefetvnisrtteaaeteecseiglxrnjsfkvnadetarenusaimnitesnteearstaoluiehtcnrrdrueuhiheovmnisusoslatawhvltloefnlghpicnswdcfloteisrtgigaeuueohjebrotneorgdfiesddhmootercsrvdnhhitleeeddaeoteoigabrsiadoaeprfrraefcnehaltesiucnuogueeteotausrtghwlrftelyaitefieebeodterehttoltrottiiliuhmeigeeevdnacrtnoalhsintennasrraofcrlfolnomlentsfhsinadercroeigrtducmsynedothsneythfrncneeosatnifighdlinoorsspicabtolyicsihlyaroeoetcasclgotynnsnomfhdlgibtrsneesrpoctsniiulinligetosnmnsuataatusceyshnapaonsutdvdasaeitenenwyehrtpaonovteetflatoithyaeatoiyirfiihohraamsttrlfvnsthaeicsinenteareiraiprattkteeteetnteeeaeeundroeiieodhtshraintedoervnoawsadoltkoabercshtuhrpsilptaturetnehsbleaetrlrtgitdfilmimlaebeoeeihhhlhdsigfinpasmnfuninowwthmoaticnemreftaihsgfrhmetfhratetnnefazocaoaasmtoemorsvleetaknadaaelitewudnfgtolutaewtscheivleteicstacerwudaetnhpoecntepladoddoollyartapyncpesrtnommeeeiusnsnofesaeteotnheigpouwtteiecwnorprfotcmntenushotmnbtfagsgiiayeebermxmminmnoisyhmvlostmhciiroshprabthilwraesaehdrtaibbtenkofcaeoteehlwrcfladcacutfdsusousaadhnainaseeewtifrsnloedsusoogedeteetnareoteulitxlitititathoigocicntpelrtntbrtosnmeiaploluwnmdsnwtpahvcmtatelstaeyfttraemeotetossoynuncaypracaidviksgauitniudrieiiyodpaservrtigfipitoeniifehvlnlecahyrteeetpieadhbhmtestnuteiteuhhjnoolotetdaelolotooshyetdidsuihnaodhisndoemoyhyaeodfhmatrhdehvrtohihmtarcreoeteyeoonehroenwhtaeednywahsereatenweeotsaehhnubsettiieoennnwtaeeolodcadaptbaltoiwttoscaiihdrefiiaannaderigihhrhshigenociehntaeyongmnoihtdmaeadroegrhdnrsygetrsisnovnhblahrwsrkhthyntadiotoorotsihglvlnetnhdiniwshteoliteooifunirniaseeietwhpafaeyplrflrsteuirsfhrtuaetacrpruetrprpoedniigsinelgneetperhfrhwreweantetmieuoetrinctewronueaofsoarnmebsmrelaaewileetaafigmofcasltpruilaeswudeetoaefmntsftnwieieauluaecolteicshrsiutougfiilwtnyihaproaoteicsnnarodfhmoisgeoewflntepoucraneotcmfrnenniol'"
396 ]
397 },
398 "execution_count": 37,
399 "metadata": {},
400 "output_type": "execute_result"
401 }
402 ],
403 "source": [
404 "scytale_decipher(scb, 3)"
405 ]
406 },
407 {
408 "cell_type": "code",
409 "execution_count": 29,
410 "metadata": {},
411 "outputs": [],
412 "source": [
413 "history_transpositions = collections.defaultdict(list)\n",
414 "for word in history_words:\n",
415 " history_transpositions[transpositions_of(word)] += [word]"
416 ]
417 },
418 {
419 "cell_type": "code",
420 "execution_count": 30,
421 "metadata": {},
422 "outputs": [
423 {
424 "data": {
425 "text/plain": [
426 "3618"
427 ]
428 },
429 "execution_count": 30,
430 "metadata": {},
431 "output_type": "execute_result"
432 }
433 ],
434 "source": [
435 "len(history_transpositions)"
436 ]
437 },
438 {
439 "cell_type": "code",
440 "execution_count": 38,
441 "metadata": {},
442 "outputs": [
443 {
444 "data": {
445 "text/plain": [
446 "(((1, 0, 4, 3, 2), False, False), -5002.149995605427)"
447 ]
448 },
449 "execution_count": 38,
450 "metadata": {},
451 "output_type": "execute_result"
452 }
453 ],
454 "source": [
455 "(trans_b, fillcol_b, emptycol_b), score = column_transposition_break_mp(scb, translist=history_transpositions)\n",
456 "(trans_b, fillcol_b, emptycol_b), score"
457 ]
458 },
459 {
460 "cell_type": "code",
461 "execution_count": 39,
462 "metadata": {},
463 "outputs": [
464 {
465 "data": {
466 "text/plain": [
467 "'infiltratingthedeliberationsofourenemiesisaprincipalgoalbutfollowingmydiscussionswithplayfairihavecometoseethattheclassicalstrategyoftryingtoturnaseniormemberofthedelegationsisbothriskyandunnecessaryanyapproachtosuchanindividualriskssignallingourintentionsandunderminesourabilitytoadaptourplanssecrecyiseverythingasplayfairpointsoutthoseindividualsoftenhavelittleinfluenceanywaytheyaretheretopresentapointofviewandthebestofthematleasttolistenbuttheyhavelittleauthoritythejuniorofficialsontheotherhandhavealmosttotalcontrolofeventstheysettheagendaindiscussionwithoneanotherandtheirseniorsandmoreimportantlytheytaketherecordofthemeetingafterthedelegateshavereturnedtotheirhomesitisthatrecordthatbecomestherealitywedonotneedtobethereoreventoknowwhatwassaidweneedonlytoknowwhathasbeenrecordedasthetruthandwherepossibletoshapethattruthinourbestintereststhisibelievetobeanentirelynewstrategyintheworldofdiplomacyandiampleasedtobeabletodevelopitwiththehelpofsuchadistinguishedfriendplayfairisamanofcunningandienjoyworkingwithhimnowherehasthiscunningbeenmoreeffectivethaninhisstrategyforthemanagementofthereichstadtmeetingalexanderfranzjosefgorchakovandandrassymettoagreetermsonrussiasinvolvementinthebalkansandtherewasarealriskthattheywoulduniteandfighttocontrolourtraderouteswithsuchhighlevelinvolvementinthediscussionsitwasclearthatwewouldhavelittletonohopeofinfluencingtheprincipalsandsowedecidedtofollowtheplayfairstrategyapplyingcarefulpressuretothejuniormembersoftheretinuesouragentsandofficerspersuadedthemtoreportontheproceedingsprovidinguswiththeintelligenceweneededtopreparefortheforthcomingwarbetweenrussiaandtheottomanempirebutoffargreatersignificancetheywereabletoensuremaximumconfusionamongourenemiesbythemostmarvellousstratagemwhichiwillrefertoastheplayfairgambittheofficialswereabletopersuadetheirleadersthatitwouldbebetternottotakeofficialminutesofthemeetingwhilewereceivedafullandaccurateaccountofallthediscussionstherussianandaustrohungarianofficialswereleftonlywithinformalpersonalnotesofthediscussionsandnoagreedrecordofthemeetingoritsagreedoutcomeswefullyintendtoexploitthisuncertaintyattheforthcomingconferenceinconstantinople '"
468 ]
469 },
470 "execution_count": 39,
471 "metadata": {},
472 "output_type": "execute_result"
473 }
474 ],
475 "source": [
476 "column_transposition_decipher(scb, trans_b, fillcolumnwise=fillcol_b, emptycolumnwise=emptycol_b)"
477 ]
478 },
479 {
480 "cell_type": "code",
481 "execution_count": 40,
482 "metadata": {},
483 "outputs": [
484 {
485 "name": "stdout",
486 "output_type": "stream",
487 "text": [
488 "infiltrating the deliberations of our enemies is a principal goal but following my discussions with\n",
489 "playfair i have come to see that the classical strategy of trying to turn a senior member of the\n",
490 "delegations is both risky and unnecessary any approach to such an individual risks signalling our\n",
491 "intentions and undermines our ability to adapt our plans secrecy is everything as playfair points\n",
492 "out those individuals often have little influence anyway they are there to present a point of view\n",
493 "and the best of them atleast to listen but they have little authority the junior officials on the\n",
494 "other hand have almost total control of events they set the agenda in discussion with one another\n",
495 "and their seniors and more importantly they take the record of the meeting after the delegates have\n",
496 "returned to their homes it is that record that becomes the reality we do not need to be there or\n",
497 "even to know what was said we need only to know what has been recorded as the truth and where\n",
498 "possible to shape that truth in our best interests this i believe to bean entirely new strategy in\n",
499 "the world of diplomacy and i am pleased to be able to develop it with the help of such a\n",
500 "distinguished friend playfair is a man of cunning and i enjoy working with him nowhere has this\n",
501 "cunning been more effective than in his strategy for the management of the reich stadt meeting\n",
502 "alexander franz josef g or chak ov and andrassy met to agree terms on russias involvement in the\n",
503 "balkans and there was a real risk that they would unite and fight to control our trade routes with\n",
504 "such high level involvement in the discussions it was clear that we would have little to no hope of\n",
505 "influencing the principals and so we decided to follow the playfair strategy applying careful\n",
506 "pressure to the junior members of there tinues our agents and officers persuaded them to report on\n",
507 "the proceedings providing us with the intelligence we needed to prepare for the forthcoming war\n",
508 "between russia and the ottoman empire but of far greater significance they were able to ensure\n",
509 "maximum confusion among our enemies by the most marvellous stratagem which i will refer to as the\n",
510 "playfair gambit the officials were able to persuade their leaders that it would be better not to\n",
511 "take official minutes of the meeting while we received a full and accurate account of all the\n",
512 "discussions the russian and austro hungarian officials were left only with informal personal notes\n",
513 "of the discussions and no agreed record of the meeting or its agreed outcomes we fully intend to\n",
514 "exploit this uncertainty at the forthcoming conference in constantinople \n"
515 ]
516 }
517 ],
518 "source": [
519 "print(lcat(tpack(segment(column_transposition_decipher(scb, trans_b, fillcolumnwise=fillcol_b, emptycolumnwise=emptycol_b)))))"
520 ]
521 },
522 {
523 "cell_type": "code",
524 "execution_count": 42,
525 "metadata": {},
526 "outputs": [
527 {
528 "data": {
529 "text/plain": [
530 "2599"
531 ]
532 },
533 "execution_count": 42,
534 "metadata": {},
535 "output_type": "execute_result"
536 }
537 ],
538 "source": [
539 "open('6b.plaintext', 'w').write(lcat(tpack(segment(column_transposition_decipher(scb, trans_b, fillcolumnwise=fillcol_b, emptycolumnwise=emptycol_b)))))"
540 ]
541 },
542 {
543 "cell_type": "code",
544 "execution_count": 44,
545 "metadata": {},
546 "outputs": [
547 {
548 "data": {
549 "text/plain": [
550 "['called',\n",
551 " 'banning',\n",
552 " 'carroll',\n",
553 " 'banned',\n",
554 " 'cause',\n",
555 " 'newton',\n",
556 " 'bavaria',\n",
557 " 'battle',\n",
558 " 'mayun',\n",
559 " 'barrier',\n",
560 " 'baron',\n",
561 " 'damaged',\n",
562 " 'based',\n",
563 " 'fatih',\n",
564 " 'canning',\n",
565 " 'carol',\n",
566 " 'basic',\n",
567 " 'jerome',\n",
568 " 'revues',\n",
569 " 'earlier',\n",
570 " 'mission']"
571 ]
572 },
573 "execution_count": 44,
574 "metadata": {},
575 "output_type": "execute_result"
576 }
577 ],
578 "source": [
579 "history_transpositions[trans_b]"
580 ]
581 },
582 {
583 "cell_type": "code",
584 "execution_count": 45,
585 "metadata": {},
586 "outputs": [
587 {
588 "data": {
589 "text/plain": [
590 "['baked',\n",
591 " 'baled',\n",
592 " 'bared',\n",
593 " 'barge',\n",
594 " 'baron',\n",
595 " 'based',\n",
596 " 'basic',\n",
597 " 'basie',\n",
598 " 'bated',\n",
599 " 'bathe',\n",
600 " 'baton',\n",
601 " 'baulk',\n",
602 " 'bayed',\n",
603 " 'caged',\n",
604 " 'caked',\n",
605 " 'calif',\n",
606 " 'caned',\n",
607 " 'caped',\n",
608 " 'capon',\n",
609 " 'cared',\n",
610 " 'carne',\n",
611 " 'carol',\n",
612 " 'carom',\n",
613 " 'carpi',\n",
614 " 'cased',\n",
615 " 'caulk',\n",
616 " 'cause',\n",
617 " 'caved',\n",
618 " 'cawed',\n",
619 " 'eaton',\n",
620 " 'fermi',\n",
621 " 'heron',\n",
622 " 'jason',\n",
623 " 'karol',\n",
624 " 'layup',\n",
625 " 'lexus',\n",
626 " 'mason',\n",
627 " 'mauro',\n",
628 " 'meson',\n",
629 " 'metro',\n",
630 " 'mixup',\n",
631 " 'newts',\n",
632 " 'nexts',\n",
633 " 'nexus',\n",
634 " 'onyxs',\n",
635 " 'pouts',\n",
636 " 'routs',\n",
637 " 'babied',\n",
638 " 'bagged',\n",
639 " 'balled',\n",
640 " 'banned',\n",
641 " 'barbed',\n",
642 " 'barbie',\n",
643 " 'barker',\n",
644 " 'baroda',\n",
645 " 'barred',\n",
646 " 'barrie',\n",
647 " 'barron',\n",
648 " 'bashes',\n",
649 " 'basics',\n",
650 " 'batted',\n",
651 " 'battle',\n",
652 " 'bauble',\n",
653 " 'cached',\n",
654 " 'called',\n",
655 " 'callie',\n",
656 " 'canine',\n",
657 " 'caning',\n",
658 " 'canned',\n",
659 " 'capped',\n",
660 " 'carafe',\n",
661 " 'carnal',\n",
662 " 'carpal',\n",
663 " 'carrie',\n",
664 " 'cashes',\n",
665 " 'cassie',\n",
666 " 'cattle',\n",
667 " 'causal',\n",
668 " 'causes',\n",
669 " 'cayley',\n",
670 " 'cayuga',\n",
671 " 'damage',\n",
672 " 'dandle',\n",
673 " 'dannie',\n",
674 " 'dapple',\n",
675 " 'darker',\n",
676 " 'darned',\n",
677 " 'darner',\n",
678 " 'dashed',\n",
679 " 'dashes',\n",
680 " 'dawdle',\n",
681 " 'dawned',\n",
682 " 'dazzle',\n",
683 " 'geyser',\n",
684 " 'heusen',\n",
685 " 'heuser',\n",
686 " 'jasons',\n",
687 " 'jerome',\n",
688 " 'kernel',\n",
689 " 'ketone',\n",
690 " 'lazaro',\n",
691 " 'lesson',\n",
692 " 'lexuss',\n",
693 " 'lissom',\n",
694 " 'litton',\n",
695 " 'lizzys',\n",
696 " 'maroon',\n",
697 " 'masons',\n",
698 " 'neuron',\n",
699 " 'neuter',\n",
700 " 'newton',\n",
701 " 'nexuss',\n",
702 " 'pewter',\n",
703 " 'revues',\n",
704 " 'babbled',\n",
705 " 'banning',\n",
706 " 'barnard',\n",
707 " 'barrage',\n",
708 " 'barrier',\n",
709 " 'barroom',\n",
710 " 'bassoon',\n",
711 " 'bavaria',\n",
712 " 'bazooka',\n",
713 " 'canning',\n",
714 " 'carfare',\n",
715 " 'carrier',\n",
716 " 'carroll',\n",
717 " 'cassies',\n",
718 " 'cassock',\n",
719 " 'catarrh',\n",
720 " 'dallied',\n",
721 " 'damaged',\n",
722 " 'dandled',\n",
723 " 'dappled',\n",
724 " 'dawdled',\n",
725 " 'dazzled',\n",
726 " 'earlier',\n",
727 " 'earmark',\n",
728 " 'fanning',\n",
729 " 'ganglia',\n",
730 " 'gautama',\n",
731 " 'geysers',\n",
732 " 'jejunum',\n",
733 " 'lessons',\n",
734 " 'mission',\n",
735 " 'navarro',\n",
736 " 'nexuses',\n",
737 " 'reuters',\n",
738 " 'reverts',\n",
739 " 'barbaric',\n",
740 " 'barbered',\n",
741 " 'bassoons',\n",
742 " 'carapace',\n",
743 " 'careered',\n",
744 " 'cassocks',\n",
745 " 'caucuses',\n",
746 " 'darneder',\n",
747 " 'gangling',\n",
748 " 'jiujitsu',\n",
749 " 'layaways',\n",
750 " 'missions',\n",
751 " 'jiujitsus']"
752 ]
753 },
754 "execution_count": 45,
755 "metadata": {},
756 "output_type": "execute_result"
757 }
758 ],
759 "source": [
760 "transpositions[trans_b]"
761 ]
762 },
763 {
764 "cell_type": "code",
765 "execution_count": null,
766 "metadata": {},
767 "outputs": [],
768 "source": []
769 }
770 ],
771 "metadata": {
772 "kernelspec": {
773 "display_name": "Python 3",
774 "language": "python",
775 "name": "python3"
776 },
777 "language_info": {
778 "codemirror_mode": {
779 "name": "ipython",
780 "version": 3
781 },
782 "file_extension": ".py",
783 "mimetype": "text/x-python",
784 "name": "python",
785 "nbconvert_exporter": "python",
786 "pygments_lexer": "ipython3",
787 "version": "3.6.6"
788 }
789 },
790 "nbformat": 4,
791 "nbformat_minor": 2
792 }