Done challenge 9
[cipher-challenge.git] / 2021 / 2021-challenge9.ipynb
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 78,
6 "id": "5c19999b",
7 "metadata": {
8 "Collapsed": "false"
9 },
10 "outputs": [],
11 "source": [
12 "from szyfrow.caesar import *\n",
13 "from szyfrow.affine import *\n",
14 "from szyfrow.keyword_cipher import *\n",
15 "from szyfrow.column_transposition import *\n",
16 "from szyfrow.vigenere import *\n",
17 "from szyfrow.polybius import *\n",
18 "from szyfrow.railfence import *\n",
19 "from szyfrow.hill import *\n",
20 "from szyfrow.support.text_prettify import *\n",
21 "\n",
22 "import numpy as np\n",
23 "import pandas as pd\n",
24 "import matplotlib.pyplot as plt\n",
25 "\n",
26 "import collections\n",
27 "%matplotlib inline"
28 ]
29 },
30 {
31 "cell_type": "code",
32 "execution_count": 37,
33 "id": "d9dd1b5e",
34 "metadata": {
35 "Collapsed": "false"
36 },
37 "outputs": [],
38 "source": [
39 "challenge_number = 9\n",
40 "plaintext_a_filename = f'plaintext.{challenge_number}a.txt'\n",
41 "plaintext_b_filename = f'plaintext.{challenge_number}b.txt'\n",
42 "ciphertext_a_filename = f'ciphertext.{challenge_number}a.txt'\n",
43 "ciphertext_b_filename = f'ciphertext.{challenge_number}b.txt'"
44 ]
45 },
46 {
47 "cell_type": "code",
48 "execution_count": 38,
49 "id": "0f1f792a",
50 "metadata": {
51 "Collapsed": "false"
52 },
53 "outputs": [],
54 "source": [
55 "ca = open(ciphertext_a_filename).read()\n",
56 "cb = open(ciphertext_b_filename).read()\n",
57 "\n",
58 "\n",
59 "sca = sanitise(ca)\n",
60 "rsca = cat(reversed(sca))\n",
61 "scb = sanitise(cb)\n",
62 "rscb = cat(reversed(scb))"
63 ]
64 },
65 {
66 "cell_type": "code",
67 "execution_count": 4,
68 "id": "b8d5f9ec-27f1-498b-8e64-c5eb2424e581",
69 "metadata": {},
70 "outputs": [
71 {
72 "data": {
73 "text/plain": [
74 "Counter({'a': 190,\n",
75 " 'g': 49,\n",
76 " 'y': 56,\n",
77 " 'b': 28,\n",
78 " 'w': 66,\n",
79 " 'd': 80,\n",
80 " 'l': 101,\n",
81 " 'k': 21,\n",
82 " 'n': 160,\n",
83 " 't': 242,\n",
84 " 'o': 168,\n",
85 " 'h': 132,\n",
86 " 'i': 184,\n",
87 " 'r': 122,\n",
88 " 'p': 31,\n",
89 " 'e': 260,\n",
90 " 's': 119,\n",
91 " 'u': 59,\n",
92 " 'f': 39,\n",
93 " 'c': 57,\n",
94 " 'v': 26,\n",
95 " 'm': 48,\n",
96 " 'x': 2,\n",
97 " 'j': 1})"
98 ]
99 },
100 "execution_count": 4,
101 "metadata": {},
102 "output_type": "execute_result"
103 }
104 ],
105 "source": [
106 "sca_counts = collections.Counter(sca)\n",
107 "sca_counts"
108 ]
109 },
110 {
111 "cell_type": "code",
112 "execution_count": 5,
113 "id": "b5cabba1-ac75-46ea-ac05-8699cc88d986",
114 "metadata": {
115 "tags": []
116 },
117 "outputs": [
118 {
119 "data": {
120 "text/plain": [
121 "<AxesSubplot:>"
122 ]
123 },
124 "execution_count": 5,
125 "metadata": {},
126 "output_type": "execute_result"
127 },
128 {
129 "data": {
130 "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAR4UlEQVR4nO3df7DldV3H8edLJDRAg1hwA3TR2RQow1zBRpwoKlBz0BJbaojK2iIo7IcFZmlOmzilzmRholibobipBDOWRFsNUirsAvFjF8ZVfriywfordhxFdn33x/munC7n3vO95967e++H52PmzDnfz/l8zvd9v3fP63zO9/u9301VIUlqyxP2dQGSpPlnuEtSgwx3SWqQ4S5JDTLcJalBhrskNeiJ+7oAgMMOO6xWrFixr8uQpCVl06ZNX6yqZaOeWxThvmLFCjZu3Livy5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/b8bmf44Lu3x2uP8mrgdODPq+qrSZYDr5uuc1X9L4PjPmdN12cmUz7Y9wOWAWOPBSU5F/iZrv+HgV/p+V6/FXg+8H0M6v5qkk9W1ddnGHMjg11xLwC+G3h3kldV1avG1PibwDkMLhb2XuB1VfVIkicAnwF6hfuiPaC6R5IfBp7KYHfHN6fp84yZXmMO/2DHSvKDPHqw67qqurnnuOcApzJ4g2+oqi0LVOKe9T2fQbiEwW6FaffX78vtuRQkua2qvn+CcSO367jt2f0b2/O76/VvrPXf4ZSfbxfwQFXt6jHuYuCKmuFEgjHjD2Lw4f67DE6COGCGvqumvs+SnF1VMx77SPJm4LJRv6Mkx/bNikUf7tJik+Q9wDt6zvjUgO4MlhczmL3fy6NnzvzbPi1sBoa7NEtJtgDPYnDwbzHurtI8S/I6BoG+qc83hMXAcJdmadLdK9LeZLhLUoMW5R8xSZLmxnCXpAYZ7pLUIMNdkhpkuEtSg/4P/RyaCr9NUrgAAAAASUVORK5CYII=\n",
131 "text/plain": [
132 "<Figure size 432x288 with 1 Axes>"
133 ]
134 },
135 "metadata": {
136 "needs_background": "light"
137 },
138 "output_type": "display_data"
139 }
140 ],
141 "source": [
142 "pd.Series(sca_counts).sort_index().plot.bar()"
143 ]
144 },
145 {
146 "cell_type": "code",
147 "execution_count": 20,
148 "id": "4a063a9d-2965-4d80-b01c-211d5d884d8f",
149 "metadata": {},
150 "outputs": [],
151 "source": [
152 "import itertools"
153 ]
154 },
155 {
156 "cell_type": "code",
157 "execution_count": 26,
158 "id": "000a175e-5afa-45fd-b347-a99fb619b469",
159 "metadata": {},
160 "outputs": [
161 {
162 "data": {
163 "text/plain": [
164 "362880"
165 ]
166 },
167 "execution_count": 26,
168 "metadata": {},
169 "output_type": "execute_result"
170 }
171 ],
172 "source": [
173 "permutes = [transpositions_of(cat(t)) for t in itertools.permutations('abcdefghi')]\n",
174 "len(permutes)"
175 ]
176 },
177 {
178 "cell_type": "code",
179 "execution_count": 27,
180 "id": "9055ba6c-6fea-4668-aa83-41deff3ba806",
181 "metadata": {},
182 "outputs": [
183 {
184 "data": {
185 "text/plain": [
186 "((1, 4, 6, 3, 5, 7, 0, 2, 8), False, True)"
187 ]
188 },
189 "execution_count": 27,
190 "metadata": {},
191 "output_type": "execute_result"
192 }
193 ],
194 "source": [
195 "key_a, _ = column_transposition_break(sca, translist=permutes, fitness=Ptrigrams)\n",
196 "word_a, fill_a, empty_a = key_a\n",
197 "word_a, fill_a, empty_a"
198 ]
199 },
200 {
201 "cell_type": "code",
202 "execution_count": 29,
203 "id": "7fad89d5-b42e-40d6-ad4d-a8d41cacca84",
204 "metadata": {},
205 "outputs": [
206 {
207 "data": {
208 "text/plain": [
209 "'harryifyouarereadingthisthenyouareprobablyalsowonderingwhereiamiamsorrytodisappearbutihavealottothinkaboutandneedtoworkthingsoutonmyowniamonthetraintomassourienowandhopingthatiwillfindtheanswersineedtherethoughihavealreadybeguntoputthepiecestogetherthestorystartedatmichaelfaradayslighthouseattrinitywharfandthatshouldhavebeenabigclueespeciallywiththereferencetothefacilityinflorenceslettertohimwetakeitsomuchforgrantednowthatwemissedtheimportanceofthatplaceitwaswhenilookedintosouterpointthatirealisedwhyitmightberelevantandnowasitravelthroughthefoothillsofthehimalayaitisallcomingintofocustheattachedreportwasdiscoveredbyoneoftheelvesinthelampatsouterpointandwasclearlyleftthereformetofindiamstillnotsurewhattheconspiracysetouttodobutinowknowthesignificanceoftrinitywharfandsouterandicantakeagoodguessatwhytheywereinterestedingeorgeeverestshouseinthemountainsidontknowwhyithinktheremightstillbesomethingtofindtherebutsincetheconspiracyisclearlystillactiveihavetoknowwhattheyaredoingandthisistheonlyleadihavetheconnectionbetweentheearlyconspiratorsisalsomuchclearertomenowtheyallhadaninterestinmathematicsandthenaturalsciencesadalovelacewasakeymemberofbabbagesteamwithherearlyexperimentswithprogrammingmaryeverestboolewasanexpertinlogichighlyeducatedandwellversedinindianmathematicalthoughtatfirstflorencenightingaledoesntlooklikeagreatfitwiththegroupsheiscelebratedmoreformodernisingnursingbutherinnovationswerebasedonseriousdataanalysisusingeverythingsheknewaboutstatisticsandthatwasalotcarolineherschelwasanotherremarkablewomanthefirsttobepaidasalaryasascientistbutithinkherrolewassomethingmoreshehadhugeinfluenceinsocietyandalsoheldapositioningovernmentlikecharlieandtrinityshewastechnicallygiftedandwellplacedtotakefulladvantageofthosegiftsineedtoknowwhattheyaretryingtodowhyandhowtrinitywarnedmenottotellyouaboutherletterbutthatwasneverapossibilityevenifididntletyouknowwhatwasgoingoniamprettysurethatyouwouldhavefoundoutandiwouldmuchrathertellyoumyselftheonlyreasonididntcometoyoustraightawayisthatistilldontknowwhatisgoingonandididntwanttoputyouinthedifficultpositionofhavingtodecidewhethertotrustmeornothopefullythisvisitwillprovidetheevidenceweneedtounraveltheconspiracyandtoclearmynameiwillwritetoyouagainwithnewsfromtheparkjodie'"
210 ]
211 },
212 "execution_count": 29,
213 "metadata": {},
214 "output_type": "execute_result"
215 }
216 ],
217 "source": [
218 "# mod_word_a = (1, 3, 6, 4, 5, 7, 0, 2, 8)\n",
219 "pa = column_transposition_decipher(sca, word_a, \n",
220 " fillcolumnwise=fill_a, emptycolumnwise=empty_a)\n",
221 "pa"
222 ]
223 },
224 {
225 "cell_type": "code",
226 "execution_count": 30,
227 "id": "b3271971-d4b5-4f8a-aab7-0ca141b83f5f",
228 "metadata": {},
229 "outputs": [
230 {
231 "name": "stdout",
232 "output_type": "stream",
233 "text": [
234 "harry if you are reading this then you are probably also wondering where i am i am sorry to\n",
235 "disappear but i have alot to think about and need to work things out on my own i am on the train to\n",
236 "mass our ie now and hoping that i will find the answers i need there though i have already begun to\n",
237 "put the pieces together the story started at michael far a days lighthouse at trinity wharf and that\n",
238 "should have been a big clue especially with the reference to the facility in florence s letter to\n",
239 "him we take it so much for granted now that we missed the importance of that place it was when i\n",
240 "looked into souter point that i realised why it might be relevant and no was i travel through the\n",
241 "foothills of the himalaya it is all coming into focus the attached report was discovered by one of\n",
242 "the elves in the lamp at souter point and was clearly left there for met of india m still not sure\n",
243 "what the conspiracy set out to do but i now know the significance of trinity wharf and souter and i\n",
244 "can take a good guess at why they were interested in george everest s house in the mountains i dont\n",
245 "know why i think there might still be something to find there but since the conspiracy is clearly\n",
246 "still active i have to know what they are doing and this is the only lead i have the connection\n",
247 "between the early conspirators is also much clearer to me now they all had an interest in\n",
248 "mathematics and the natural sciences ada lovelace was a key member of babbage steam with her early\n",
249 "experiments with programming mary everest boole was an expert in logic highly educated and well\n",
250 "versed in indian mathematical thought at first florence nightingale doesnt look like a great fit\n",
251 "with the group she is celebrated more for modernising nursing but her innovations were based on\n",
252 "serious data analysis using everything she knew about statistics and that was alot caroline herschel\n",
253 "was another remarkable woman the first to be paid a salary as a scientist but i think her role was\n",
254 "something more she had huge influence in society and also held a position in government like charlie\n",
255 "and trinity she was technically gifted and well placed to take full advantage of those gifts i need\n",
256 "to know what they are trying to do why and how trinity warned me not to tell you about her letter\n",
257 "but that was never a possibility even if i didnt let you know what was going on i am pretty sure\n",
258 "that you would have found out and i would much rather tell you myself the only reason i didnt come\n",
259 "to you straightaway is that i still dont know what is going on and i didnt want to put you in the\n",
260 "difficult position of having to decide whether to trust me or not hopefully this visit will provide\n",
261 "the evidence we need to unravel the conspiracy and to clear my name i will write to you again with\n",
262 "news from the park jodie\n"
263 ]
264 }
265 ],
266 "source": [
267 "print(prettify(pa))"
268 ]
269 },
270 {
271 "cell_type": "code",
272 "execution_count": 31,
273 "id": "46512a70-68d4-4ea9-8f66-b39966232fa6",
274 "metadata": {
275 "Collapsed": "false",
276 "tags": []
277 },
278 "outputs": [
279 {
280 "data": {
281 "text/plain": [
282 "2772"
283 ]
284 },
285 "execution_count": 31,
286 "metadata": {},
287 "output_type": "execute_result"
288 }
289 ],
290 "source": [
291 "open(plaintext_a_filename, 'w').write(prettify(pa))"
292 ]
293 },
294 {
295 "cell_type": "code",
296 "execution_count": 41,
297 "id": "24d8ad2e-b237-479b-9a62-af9bc8d100d5",
298 "metadata": {},
299 "outputs": [
300 {
301 "data": {
302 "text/plain": [
303 "Counter({'v': 129,\n",
304 " 'r': 173,\n",
305 " 'd': 103,\n",
306 " 'p': 124,\n",
307 " 'k': 68,\n",
308 " 'w': 107,\n",
309 " 'f': 95,\n",
310 " 'a': 234,\n",
311 " 'o': 176,\n",
312 " 'm': 96,\n",
313 " 'z': 47,\n",
314 " 'e': 265,\n",
315 " 'u': 66,\n",
316 " 't': 245,\n",
317 " 'c': 92,\n",
318 " 'l': 170,\n",
319 " 'h': 173,\n",
320 " 'g': 111,\n",
321 " 'i': 152,\n",
322 " 'x': 51,\n",
323 " 'n': 164,\n",
324 " 'b': 119,\n",
325 " 's': 118,\n",
326 " 'y': 40,\n",
327 " 'q': 68,\n",
328 " 'j': 44})"
329 ]
330 },
331 "execution_count": 41,
332 "metadata": {},
333 "output_type": "execute_result"
334 }
335 ],
336 "source": [
337 "scb_counts = collections.Counter(scb)\n",
338 "scb_counts"
339 ]
340 },
341 {
342 "cell_type": "code",
343 "execution_count": 42,
344 "id": "d66dd0d0-badb-44f3-a8a6-f7edd17d1532",
345 "metadata": {
346 "tags": []
347 },
348 "outputs": [
349 {
350 "data": {
351 "text/plain": [
352 "<AxesSubplot:>"
353 ]
354 },
355 "execution_count": 42,
356 "metadata": {},
357 "output_type": "execute_result"
358 },
359 {
360 "data": {
361 "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAASVklEQVR4nO3de7DcZX3H8fdHtGgBLZSAKaBBJl6gKuoR7YhTWlvB26Ct2NAORavGC7TaWgtYW63TtDj1MlNbUBQUFcVUpdDRipjqIPWCCSKXBMYoqJEI8Z5xFE389o/9pSyHvZ1bcvLk/ZrZ2f09+zy/3/fs2fPZZ5+9nFQVkqS23GtXFyBJmn+G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D/hO4IskPGPHVBX2BcB/gT5N8s9t+ML1ZyUBV9d4ka4HfpfeH9gc1bS1tgPcBVye5pDvGc+g9LR3lX4FLgIOSrKK35PDaMWNm4wP0nmJf2m0/C/hgkn2Ydjv03Wb3Bl6Q5Ov0wm3smvMCe+ZOPt4L6D0zvA93PeAWMCrcjwWen+QWJr/N3k3vAeqSbvvZwPljansCd92foRfeG3b87gYcbzb3TarqG+P6TPM84ATgTVX1wyRLgVcP2feP6L3uc/Kg60eZ9kC/F7AEGPq6RpKXAX/U9fsw8OIJ/p6vAx4H/GZX5w+TfL6qfjpizJfoLc09Hvh14B1JnltVzx1R218Ap9L74q93Aa+uql8kuRfwVWBQuL99x4Wqek93e5w25ue5+3G7pwCLUpLfpvd05BPV++rgQX0ePGofs7jzjqvpsdz1wtiVVfXlCcY8HHgKvSBYU1Ub5rOmvuM8jl74hN6Sw8C1+p19my1WSa6vqkfOcMzA227cbdbdb3b8bsbeb2bzO5rNfXOxmvbzbwNu72ayw/qfDVxcQ948MOZY+9J7oP9rem922HtE36npf1dJTqmqoa+HJHkDcP6Q39kjFiwPFnO4SwspyTuBt04ww1ODunexPJne7P0b3PXOmf/ZpYXNE8Nde6wkG4Aj6L3AtxiWpbQTJXk1vUBfN+pZwe7KcNcea7ZLLNLuwHCXpAYtug8xSZLmznCXpAYZ7pLUIMNdkhpkuEtSg/4PXG2p4WznpsMAAAAASUVORK5CYII=\n",
362 "text/plain": [
363 "<Figure size 432x288 with 1 Axes>"
364 ]
365 },
366 "metadata": {
367 "needs_background": "light"
368 },
369 "output_type": "display_data"
370 }
371 ],
372 "source": [
373 "pd.Series(scb_counts).sort_index().plot.bar()"
374 ]
375 },
376 {
377 "cell_type": "code",
378 "execution_count": 79,
379 "id": "5bb4afa4-22c2-4826-87ad-a0f3e7aa867d",
380 "metadata": {},
381 "outputs": [],
382 "source": [
383 "key_b, _ = hill_break(scb, fitness=Ptrigrams)"
384 ]
385 },
386 {
387 "cell_type": "code",
388 "execution_count": 84,
389 "id": "875b1073-dd5c-4c4d-a028-865933ac472e",
390 "metadata": {},
391 "outputs": [
392 {
393 "data": {
394 "text/plain": [
395 "matrix([[1, 1],\n",
396 " [1, 0]])"
397 ]
398 },
399 "execution_count": 84,
400 "metadata": {},
401 "output_type": "execute_result"
402 }
403 ],
404 "source": [
405 "key_b"
406 ]
407 },
408 {
409 "cell_type": "code",
410 "execution_count": 81,
411 "id": "8107ca5f-b2e7-475b-abc5-0f9b7ec1863a",
412 "metadata": {},
413 "outputs": [
414 {
415 "data": {
416 "text/plain": [
417 "'reportfrommaryeverestbooletothecuriaofthetrinityfoundationthisreportwascommissionedbythecuriatorecordtheoutcomeofthecommissioningandactivitiesofthesouterpointfacilityandtomakerecommendationsonitsdevelopmentafteryearsofpioneeringworkbyfaradayandothersthedevelopmentoftheirextraordinarymachinesoutgrewthecapacityinourheadquartersattrinitywharfwitheachnewincreaseinspeedandpowertheriskofdiscoverygrewuntilthecuriahadnochoicebuttocommissionanewfacilityinspiredbythelessonslearnedinlondonitwasdecidedtobuildalargerestablishmentundercoveroftheconstructionofthesouterpointlighthousethefirstdedicatedelectricallypoweredlampofitskindthegrowthinminingintheareaprovidedexcellentcoverfortheinstallationofournetworkofcavernsunderneaththelighthouseandtheinstallationandmaintenanceofthelighthouselampsteamenginespumpsandgeneratorsdisguisedourownactivitiesasweequippedthebasetheholmesgeneratorsthatweprocuredareidenticaltothoseselectedforthelighthousesothatsparepartscanbeprocuredeasilywithoutraisingsuspiciontheyaredrivenbyapairofsteamengineslocateddeepintherockofcleadonhillbeneaththelighthouseengineroommuchofthenoiseandheattheyproduceismuffledbytherocksandthatwhichescapesismistakenbyneighboursforthechurningofthelighthousemachineryitseemsthatnosuspicionshavebeenarousedamongthelocalswhocontinuetobelievethatouractivitiesaresomehowrelatedtothelighthouseandtheminesitisawondertobeholdtheheavymachineryconvertingthemovementofthemassiveflywheelintotheimperceptiblemotionofmysteriouselectricalchargesthroughthewiresitisdifficulttocomprehendthatthevariouspartsofthemachinecancombinetoproduceanythingapproachinghumanthoughtandyetitcomputesmoreoverthiscomputerembodiesthevisionofthecountessoflovelacethatofamachinewhichcangobeyondmerecalculationtotheanalysisofthevastscreedsofinformationthatnowcrosstheworldbythemiracleoftelegraphyourstaffatsouterpointhavebeenabletoexploittheadditionalenergyprovidedbythenewgeneratorstodoublethecomputingpoweroftheanalyticalengineandarenowabletoprocesstwiceasmanytelegramsinthesametimeusingthestatisticaltechniquespioneeredbybabbageandnightingaleandaidedbythepowerofthedevicethemostsecurelyencipheredmessagesyieldtheirsecretsprovidingintelligencebeyondanythingthatcouldbeascertainedbyeventhelargestnetworkofagentswhilethismuchisgoodandtobecelebratedthereisalsobadnewsiamdisappointedtoreportthattheadditionalvolumeoftrafficonthetelegraphynetworkandtheincreasedrateatwhichwehavebeenabletodecipherthosemessageshasstretchedtheabilityofourmostpowerfulenginethefoundationmachinetosupporttheanalystsintheirworkasaresultweriskdrowningininformationwecannotusewehavereachedthelimitsofwhatonemachinecandoandifwearetomakethemostofthisnewbountythenwewillneedtolinkseveralintheircomputationssothattheycananalyseandreportwhattheyfindasfastasthemessagesflowthiswillrequireanenormousincreaseinourproductionofelectricitywhichcannotbeachievedbycombustionwithoutalargeincreaseintheconsumptionoffuelthecostwouldbeprohibitivebutevenifitcouldbemetthecorrespondingincreaseintheproductionofheatandnoisewouldbeunlikelytoescapeattentionevenonthewildnortheastcoastifwearetorealiseourfullambitionsweneedtofindamoreremotelocationwithareadysourceofpoweredisonsworkatappletonshowsgreatpromiseandithinkiknowtheideallocationtobuilditmaryeverestboole'"
418 ]
419 },
420 "execution_count": 81,
421 "metadata": {},
422 "output_type": "execute_result"
423 }
424 ],
425 "source": [
426 "pb = hill_decipher(key_b, scb)\n",
427 "pb"
428 ]
429 },
430 {
431 "cell_type": "code",
432 "execution_count": 82,
433 "id": "c7f2e770-8062-4d18-b90a-cb2e410ef88c",
434 "metadata": {},
435 "outputs": [
436 {
437 "name": "stdout",
438 "output_type": "stream",
439 "text": [
440 "report from mary everest boole to the curia of the trinity foundation this report was commissioned\n",
441 "by the curia to record the outcome of the commissioning and activities of the souter point facility\n",
442 "and to make recommendations on its development after years of pioneering work by faraday and others\n",
443 "the development of their extraordinary machines outgrew the capacity in our headquarters at trinity\n",
444 "wharf with each new increase in speed and power the risk of discovery grew until the curia had no\n",
445 "choice but to commission a new facility inspired by the lessons learned in london it was decided to\n",
446 "build a larger establishment undercover of the construction of the souter point lighthouse the first\n",
447 "dedicated electrically powered lamp of its kind the growth in mining in the area provided excellent\n",
448 "cover for the installation of our network of caverns underneath the lighthouse and the installation\n",
449 "and maintenance of the lighthouse lamps team engines pumps and generators disguised our own\n",
450 "activities as we equipped the base the holmes generators that we procured are identical to those\n",
451 "selected for the lighthouse so that spareparts can be procured easily without raising suspicion they\n",
452 "are driven by a pair of steam engines located deep in the rock of c lead on hill beneath the\n",
453 "lighthouse engine room much of the noise and heat they produce is muffled by the rocks and that\n",
454 "which escapes is mistaken by neighbours for the churning of the lighthouse machinery it seems that\n",
455 "no suspicions have been aroused among the locals who continue to believe that our activities are\n",
456 "somehow related to the lighthouse and the mines it is a wonder to behold the heavy machinery\n",
457 "converting the movement of the massive flywheel into the imperceptible motion of mysterious\n",
458 "electrical charges through the wires it is difficult to comprehend that the various parts of the\n",
459 "machine can combine to produce anything approaching human thought and yet it computes moreover this\n",
460 "computer embodies the vision of the countess of lovelace that of a machine which can go beyond mere\n",
461 "calculation to the analysis of the vast screeds of information that now cross the world by the\n",
462 "miracle of telegraph your staff at souter point have be enable to exploit the additional energy\n",
463 "provided by the new generators to double the computing power of the analytical engine and are now\n",
464 "able to process twice as many telegrams in the same time using the statistical techniques pioneered\n",
465 "by babbage and nightingale and aided by the power of the device the most securely enciphered\n",
466 "messages yield their secrets providing intelligence beyond anything that could be ascertained by\n",
467 "even the largest network of agents while this much is good and to be celebrated there is also bad\n",
468 "new siam disappointed to report that the additional volume of traffic on the telegraphy network and\n",
469 "the increased rate at which we have be enable to decipher those messages has stretched the ability\n",
470 "of our most powerful engine the foundation machine to support the analysts in their work as a result\n",
471 "we risk drowning in information we can not use we have reached the limits of what one machine can do\n",
472 "and if we are to make the most of this new bounty then we will need to link several in their\n",
473 "computations so that they can analyse and report what they find as fast as the messages flow this\n",
474 "will require an enormous increase in our production of electricity which can not be achieved by\n",
475 "combustion without a large increase in the consumption of fuel the cost would be prohibitive but\n",
476 "even if it could be met the corresponding increase in the production of heat and noise would be\n",
477 "unlikely to escape attention even on the wild northeast coast if we are to realise our full\n",
478 "ambitions we need to find a more remote location with a ready source of powered i sons work at\n",
479 "appleton shows great promise and i think i know the ideal location to build it mary everest boole\n"
480 ]
481 }
482 ],
483 "source": [
484 "print(prettify(pb))"
485 ]
486 },
487 {
488 "cell_type": "code",
489 "execution_count": 83,
490 "id": "d12a663c",
491 "metadata": {
492 "Collapsed": "false"
493 },
494 "outputs": [
495 {
496 "data": {
497 "text/plain": [
498 "3897"
499 ]
500 },
501 "execution_count": 83,
502 "metadata": {},
503 "output_type": "execute_result"
504 }
505 ],
506 "source": [
507 "open(plaintext_b_filename, 'w').write(prettify(pb))"
508 ]
509 },
510 {
511 "cell_type": "code",
512 "execution_count": null,
513 "id": "504ec2e2",
514 "metadata": {
515 "Collapsed": "false"
516 },
517 "outputs": [],
518 "source": []
519 }
520 ],
521 "metadata": {
522 "jupytext": {
523 "formats": "ipynb,md"
524 },
525 "kernelspec": {
526 "display_name": "Python 3 (ipykernel)",
527 "language": "python",
528 "name": "python3"
529 },
530 "language_info": {
531 "codemirror_mode": {
532 "name": "ipython",
533 "version": 3
534 },
535 "file_extension": ".py",
536 "mimetype": "text/x-python",
537 "name": "python",
538 "nbconvert_exporter": "python",
539 "pygments_lexer": "ipython3",
540 "version": "3.8.8"
541 }
542 },
543 "nbformat": 4,
544 "nbformat_minor": 5
545 }