11 "import os,sys,inspect\n",
12 "currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n",
13 "parentdir = os.path.dirname(currentdir)\n",
14 "sys.path.insert(0,parentdir) \n",
16 "import matplotlib.pyplot as plt\n",
17 "%matplotlib inline\n",
19 "from cipherbreak import *\n",
21 "c8a = open('8a.ciphertext').read()\n",
22 "c8b = open('8b.ciphertext').read()\n",
24 "c8as = sanitise(c8a)\n",
25 "c8bs = sanitise(c8b)\n"
41 "output_type": "execute_result"
45 "wap = open('../war-and-peace.txt').read()\n",
57 "['10', '00', '00', '01', '00', '111', '000', '100', '010', '101']"
62 "output_type": "execute_result"
66 "c8bc = [ch for ch in cat(c for c in c8b if c in '012').split('2') if ch]\n",
78 "[['10', '00', '00', '01', '00'],\n",
79 " ['111', '000', '100', '010', '101'],\n",
80 " ['100', '110', '011', '011', '000'],\n",
81 " ['0010111', '1010011', '1100011', '1100000', '0000001'],\n",
82 " ['0111', '0001', '0001', '0101', '1100'],\n",
83 " ['0101', '0001', '0011', '0110', '1100'],\n",
84 " ['1', '0', '0', '0', '0'],\n",
85 " ['011', '110', '101', '000', '001'],\n",
86 " ['00', '00', '01', '11', '10'],\n",
87 " ['0010', '0010', '0100', '0100', '0000']]"
92 "output_type": "execute_result"
96 "c8bchunks = chunks(c8bc, 5, fillvalue=[[]])\n",
102 "execution_count": 5,
108 "[['10000', '00010'],\n",
109 " ['10101', '10010', '10001'],\n",
110 " ['11000', '01110', '00110'],\n",
111 " ['01110', '00110', '11000', '00000', '10000', '11100', '11101'],\n",
112 " ['00001', '10011', '10000', '11110'],\n",
113 " ['00001', '10011', '00110', '11100'],\n",
115 " ['01100', '11000', '10101'],\n",
116 " ['00011', '00110'],\n",
117 " ['00000', '00110', '11000', '00000']]"
120 "execution_count": 5,
122 "output_type": "execute_result"
126 "c8bchars = [chunks(column_transposition_encipher(cat(char), 'abcde', fillcolumnwise=True, emptycolumnwise=False), 5)\n",
127 " for char in c8bchunks]\n",
133 "execution_count": 6,
142 "execution_count": 6,
144 "output_type": "execute_result"
148 "c8pos = [[int(cat(reversed(c)), 2) for c in bword] for bword in c8bchars]\n",
149 "max(n for ns in c8pos for n in ns), min(n for ns in c8pos for n in ns)"
154 "execution_count": 7,
160 "'bi vjr dom omdabhx qzbp qzmh b gdv ym amda dxdbh ebffma qtbnm hjt yv qzm kjpq abxbqdf prosmbffdhnm p'"
163 "execution_count": 7,
165 "output_type": "execute_result"
169 "c8text = wcat(cat(unpos(int(cat(reversed(c)), 2)) for c in bword) for bword in c8bchars)\n",
175 "execution_count": 8,
184 "execution_count": 8,
186 "output_type": "execute_result"
190 "len(sanitise(c8text))"
195 "execution_count": 9,
204 "execution_count": 9,
206 "output_type": "execute_result"
210 "eng_target = sanitise(wap)[:5325]\n",
216 "execution_count": 10,
225 "execution_count": 10,
227 "output_type": "execute_result"
231 "random_target = cat(random.choice(string.ascii_lowercase) for _ in range(5325))\n",
237 "execution_count": 11,
243 "(-32687.168128732188, -20426.14140719279, -30376.82045021536)"
246 "execution_count": 11,
248 "output_type": "execute_result"
252 "Ptrigrams(sanitise(c8text)), Ptrigrams(sanitise(eng_target)), Ptrigrams(sanitise(random_target))"
257 "execution_count": 12,
266 "execution_count": 12,
268 "output_type": "execute_result"
272 "(21000 - 32700) / math.log(0.75)"
277 "execution_count": 13,
286 "execution_count": 13,
288 "output_type": "execute_result"
292 "(21000 - 22000) / math.log(0.75)"
297 "execution_count": 14,
306 "execution_count": 14,
308 "output_type": "execute_result"
312 "(21000 - 32700) / math.log(0.0075)"
317 "execution_count": 15,
323 "2.788846178301471e+22"
326 "execution_count": 15,
328 "output_type": "execute_result"
332 "math.exp((21000 - 327) / 400)"
337 "execution_count": 16,
346 "execution_count": 16,
348 "output_type": "execute_result"
352 "math.exp(((-32000) - (-30000)) / 40000)"
357 "execution_count": 17,
366 "execution_count": 17,
368 "output_type": "execute_result"
372 "(-500) / math.log(0.75)"
377 "execution_count": null,
384 "execution_count": 18,
390 "'etoainhsrdlumwycfgpbvkxjqz'"
393 "execution_count": 18,
395 "output_type": "execute_result"
399 "ltrs = [p[0] for p in english_counts.most_common()]\n",
405 "execution_count": 19,
411 "'mqdbjhopzafrntgxvkiyseuclw'"
414 "execution_count": 19,
416 "output_type": "execute_result"
420 "ctls = [p[0] for p in collections.Counter(sanitise(c8text)).most_common()]\n",
426 "execution_count": 20,
433 "output_type": "stream",
435 "ap fiu ohe heodanc tras tren a yof be deod ocoan kalled twame niw bf tre gist dacatol suhveallonme sfndamote ap a oy stall olave tren fiu yof be yf inlf rige ap tref rove kalled ye tren tras letteh wall rove been dasthabuted an unenmhfgted pihy ti oll tre simaol yedao sates ond oll tre news ocenmaes an tre wihld treah noye wall be kniwn ti evehfine ond tre stihf ip wrot tref thaed ti di wall be reodlane news ap nit tren yf rige as trot fiu wall keeg tras quaet pih niw pih fiuh soke os well os pih yane yf noye as joyelao dolyoh ond a oy gohtlf hesginsable pih tras yess tras letteh as yf otteygt ti exgloan yf hile an wrot roggened an tre rige trot nitranc lake at wall eveh roggen ocoan tre sfndamote wos o civehnyent anataotave ti ghegohe pih o wihld an wramr enmhfgtain wall be si semuhe trot ni ine mon mhomk at trot wihld as olyist rehe ond tre quontuy temrnilicf hevilutain as lakelf ti cave bahtr ti at siin ap nitranc mronces ghavomf wall be obsilute ond si wall semhemf riw fiu peel obiut trot degends o lit in wri fiu ohe ond wri fiu trank ros yist ti coan a wos neuthol but wren yf phaend yohtan succested trot we miuld odogt siye ip tre temrnilicf we develiged pih tre laci ghijemt a wos exmated ot tre gissabalataes iuh glon wos ti buald berovaiuhol teyglote paltehs ti thomk chiug omtavataes in tre web ihacanollf we riged ti yidel tre sgheod ip adeos yohtan wos antehested an tre yohketanc oncle ond sow at os o wof ip sellanc ghidumts bf undehstondanc riw yeyes ghigocote a wos yihe antehested an undehstondanc riw gilatamol adeos sgheod trhiucr o gigulotain at wos o yallain yales phiy iuh heol oheos ip exgehtase ond a sriuld rove heolased tre doncehs yumr eohlaeh tre woh coyes degohtyent ot dfnoyax sow tre gitentaol pih tras tiil ti be used os o twentf pahst mentuhf vehsain ip sacant olliwanc antellacenme ocenmaes ond civehnyents ti thomk syoll chiug omtavataes bf yotmranc inlane berovaiuh ti kniwn teyglotes syoll chiugs anmludanc tehhihast mells tre gds sfndamote rod ocents ot just obiut evehf ohys yonupomtuheh an tre west anmludanc dfnoyax wren tref bemoye owohe ip iuh wihk tref ohhonced pih dfnoyax ti hemhuat us in treah antehn smreye at wos on oyozanc taye we rod evehf hesiuhme we miuld wont ond ot pahst tre pheediy ti di wrot we wonted centlf tref bhiucrt us hiund ti wihkanc in syoll chiug dfnoyam thomkanc ond pilliwanc siye ip tre hement thocedaes a wihked iut pih yfselp tre gitentaol ip iuh siptwohe ti detemt ond ghevent tehhihasy but we needed doto we molled at tre teyg bonk o dotobose ip berovaiuhol teyglotes wramr we wiuld use ti yotmr ocoanst lave inlane thoppam ti racrlacrt oheos ip antehest ni ine rod eveh wihked in tras siht ip gottehn bosed thomkanc bepihe si we rod ni doto in wramr ti bose tre teyglotes yidellanc miyyunamotain gottehns between yeybehs ip o tehhihast chiug watriut tre teyglotes at wos aygissable ti mohhf iut heol taye yinatihanc os tre doto hote wos poh tii racr pih lave onolfsas a hoased yf minmehns watr tre reod ip heseohmr ot dfnoyax ond trot wos wren a wos anthidumed ti siyeine phiy tre sfndamote tref ghiyased us doto bosed in yotreyotamol yidels develiged bf tre degohtyent ip depenme ond tre ghijemt mintanued at wos yihe summesspul tron we rod dohed ti rige o stheoy ip racr quolatf doto palled tre teyg bonk ond tre olcihatry becon ti sgit heol wihld exoygles trot mliself yotmred tre teyglotes ip miuhse o lit ip trot wos just mrotteh trehe as o wihld ip dappehenme between dasmussanc ond mohhfanc iut on ottomk ond ni semuhatf sehvame mon anvestacote evehf deluded pontosf inlane an ihdeh ti pand tre ine heol glit dfnoyax wehe exmated bf wrot we rod omraeved but os tre hesults hilled an tref deyonded yihe ommuhomf ond pih trot we needed yumr betteh doto tre sfndamote wehe roggf ti iblace ond trot as wren a heolased tre riw poh tref wehe ghegohed ti ci a thaed ti minvanme yfselp trot tre sfndamote rod ommess ti o lohce dotobose ip exastanc miyyunamotains trot tref wehe usanc ti exthomt berovaiuhol teyglotes but tre yihe a triucrt obiut at tre yihe unlakelf at seeyed iuh siptwohe wos seeanc heol wihld ottomk gottehns trot wehe susgamaiuslf sayaloh olyist mriheichogred ond a becon ti windeh ap tre gds sfndamote wehe nit just thomkanc tehhihast omtavatf but wehe enmiuhocanc at oyinc chiugs trot tref rod genethoted an ihdeh ti buald on enmfmligoedao ip berovaiuhol teyglotes trot miuld be used ti sgit putuhe ottomks bepihe tref roggened tre sfndamote rod on omralles reel at wos nit gissable ti miihdanote treah heseohmr ghichoyye watriut leovanc treah iwn dacatol piitghant yohtan ond a hepimused iuh eppihts in thomkanc trey diwn ond piund oll tre evadenme we needed but tref wehe tre exgehts nit us ond we yust rove thaccehed on olohy siyewrehe tref cove us ine mriame yf deotr wos niw anevatoble tre inlf questain wos wretreh ih nit at wiuld be poked inme a wos ippamaollf deod a wiuld rove ni ghitemtain but we wehe voluoble ti trey ond trot wos tre kef ti iuh suhvavol a neveh knew tre noye ip tre cahl tref used ti poke yf suamade but tref dad ossuhe ye trot sre rod daed ip notuhol mouses a rige trot yumr wos thue tre sfndamote wehe tre heol exgehts an esgainoce but yohtan ond a rod tre edce an midanc tref wotmred us mohepullf but we yonoced ti glont o vahus an tre dotobose encane ond at wall rove been thaccehed linc bepihe fiu heod tras at as desacned ti anpemt evehf migf ip iuh olcihatry ond ti enmhfgt mhumaol eleyents ip tre mide hendehanc at unusoble we leohned o lit phiy studfanc stuxnet ond tre teyg bonk wall suppeh tre soye pote os tre ahonaon menthapuces niw tre vahus as heleosed we minvanmed tre sfndamote ti pund o romkeh millemtave an nihwof ond ti olliw yohtan ti wihk trehe undehmiveh os poh os tref wehe minmehned re wall be rohvestanc boselane doto pih niase paltehanc an simaol yedao thoppam but re wall be dasthabutanc tras pale ond tre vahus ti os yonf sehvehs os re mon watriut olehtanc trey yohtan as ciid ot tras re ros olheodf romked o nuybeh ip bomk ug miygonf ond ogg sehvehs ond used trey os o dasthabutain yemronasy we rove olsi been leovanc o thoal pih tre antellacenme sehvames we rove ni heosin ti belaeve tre civehnyents ohe minnemted watr tras ond evehf heosin ti belaeve tref yof be iuh best rige ip stigganc trey ohe we sope ghiboblf nit ih tras ansuhonme gilamf wiuld rove heyoaned just trot we yacrt be in tre hun triucr unoble ti thacceh tre deod yon swatmr trot wos keeganc trese pales sope we di nit glon in cavanc ug ond we uhce fiu nit ti eatreh\n"
440 "trans = {pr[0]: pr[1] for pr in zip(ctls, ltrs)}\n",
441 "tt = ''.maketrans(trans)\n",
442 "print(c8text.translate(tt))"
447 "execution_count": 21,
453 "-21381.986189863124"
456 "execution_count": 21,
458 "output_type": "execute_result"
462 "Ptrigrams(sanitise(c8text.translate(tt)))"
467 "execution_count": 22,
473 "'dajoklynpigqemhstuvwxfzcbr'"
476 "execution_count": 22,
478 "output_type": "execute_result"
482 "c8alphabet0 = cat(trans[l] for l in sorted(trans))\n",
488 "execution_count": 23,
492 "# logger.setLevel(logging.DEBUG)\n",
493 "logger.setLevel(logging.WARN)"
498 "execution_count": 30,
506 "('mqjdbhzpoafrgtvnixkyseuclw', -17922.293053151883)"
509 "execution_count": 30,
511 "output_type": "execute_result"
515 "cipher_alphabet, score = simulated_annealing_break(\n",
516 " sanitise(c8text), workers=3,\n",
517 " initial_temperature=200, max_iterations=20000, \n",
518 " plain_alphabet=cat(ltrs), cipher_alphabet=cat(ctls),\n",
519 " fitness=Ptrigrams)\n",
520 "cipher_alphabet, score"
525 "execution_count": 31,
533 "'if you are reading this then i may be dead again killed twice now by the post digital surveillance syndicate if i am still alive then you may be my only hope if they have killed me then this letter will have been distributed in unencrypted form to all the social media sites and all the news agencies in the world their name will be known to everyone and the story of what they tried to do will be headline news if not then my hope is that you will keep this quiet for now for your sake as well as for mine my name is jamelia dalmar and i am partly responsible for this mess this letter is my attempt to explain my role in what happened in the hope that nothing like it will ever happen again the syndicate was a government initiative to prepare for a world in which encryption will be so secure that no one can crack it that world is almost here and the quantum technology revolution is likely to give birth to it soon if nothing changes privacy will be absolute and so will secrecy how you feel about that depends a lot on who you are and who you think has most to gain i was neutral but when my friend martin suggested that we could adapt some of the technology we developed for the ligo project i was excited at the possibilities our plan was to build behavioural template filters to track group activities on the web originally we hoped to model the spread of ideas martin was interested in the marketing angle and saw it as a way of selling products by understanding how memes propagate i was more interested in understanding how political ideas spread through a population it was a million miles from our real areas of expertise and i should have realised the dangers much earlier the war games department at dynamix saw the potential for this tool to be used as a twenty first century version of sigint allowing intelligence agencies and governments to track small group activities by matching online behaviour to known templates small groups including terrorist cells the pds syndicate had agents at just about every arms manufacturer in the west including dynamix when they became aware of our work they arranged for dynamix to recruit us on their intern scheme it was an amazing time we had every resource we could want and at first the freedom to do what we wanted gently they brought us round to working on small group dynamic tracking and following some of the recent tragedies i worked out for myself the potential of our software to detect and prevent terrorism but we needed data we called it the temp bank a database of behavioural templates which we would use to match against live online traffic to highlight areas of interest no one had ever worked on this sort of pattern based tracking before so we had no data on which to base the templates modelling communication patterns between members of a terrorist group without the templates it was impossible to carry out real time monitoring as the data rate was far too high for live analysis i raised my concerns with the head of research at dynamix and that was when i was introduced to someone from the syndicate they promised us data based on mathematical models developed by the department of defence and the project continued it was more successful than we had dared to hope a stream of high quality data filled the temp bank and the algorithm began to spot real world examples that closely matched the templates of course a lot of that was just chatter there is a world of difference between discussing and carrying out an attack and no security service can investigate every deluded fantasy online in order to find the one real plot dynamix were excited by what we had achieved but as the results rolled in they demanded more accuracy and for that we needed much better data the syndicate were happy to oblige and that is when i realised the how far they were prepared to go i tried to convince myself that the syndicate had access to a large database of existing communications that they were using to extract behavioural templates but the more i thought about it the more unlikely it seemed our software was seeing real world attack patterns that were suspiciously similar almost choreographed and i began to wonder if the pds syndicate were not just tracking terrorist activity but were encouraging it among groups that they had penetrated in order to build an encyclopaedia of behavioural templates that could be used to spot future attacks before they happened the syndicate had an achilles heel it was not possible to coordinate their research programme without leaving their own digital footprint martin and i refocused our efforts on tracking them down and found all the evidence we needed but they were the experts not us and we must have triggered an alarm somewhere they gave us one choice my death was now inevitable the only question was whether or not it would be faked once i was officially dead i would have no protection but we were valuable to them and that was the key to our survival i never knew the name of the girl they used to fake my suicide but they did assure me that she had died of natural causes i hope that much was true the syndicate were the real experts in espionage but martin and i had the edge in coding they watched us carefully but we managed to plant a virus in the database engine and it will have been triggered long before you read this it is designed to infect every copy of our algorithm and to encrypt crucial elements of the code rendering it unusable we learned a lot from studying stuxnet and the temp bank will suffer the same fate as the iranian centrifuges now the virus is released we convinced the syndicate to fund a hacker collective in norway and to allow martin to work there undercover as far as they were concerned he will be harvesting baseline data for noise filtering in social media traffic but he will be distributing this file and the virus to as many servers as he can without alerting them martin is good at this he has already hacked a number of back up company and app servers and used them as a distribution mechanism we have also been leaving a trail for the intelligence services we have no reason to believe the governments are connected with this and every reason to believe they may be our best hope of stopping them are we safe probably not or this insurance policy would have remained just that we might be on the run though unable to trigger the dead man switch that was keeping these files safe we do not plan on giving up and we urge you not to either'"
536 "execution_count": 31,
538 "output_type": "execute_result"
542 "cipher_translation = ''.maketrans(cipher_alphabet, cat(ltrs))\n",
543 "c8text.translate(cipher_translation)"
548 "execution_count": 26,
554 "# cipher_alphabet, score = simulated_annealing_break_worker(\n",
555 "# sanitise(c8text), \n",
560 "# cipher_alphabet, score"
565 "execution_count": 27,
599 "execution_count": 27,
601 "output_type": "execute_result"
605 "{chr(v): chr(k) for k, v in cipher_translation.items()}"
610 "execution_count": 28,
618 "'if you are reading this then i may be dead again killed twice now by the post digital surveillance syndicate if i am still alive then you may be my only hope if they have killed me then this letter will have been distributed in unencrypted form to all the social media sites and all the news agencies in the world their name will be known to everyone and the story of what they tried to do will be headline news if not then my hope is that you will keep this quiet for now for your sake as well as for mine my name is jamelia dalmar and i am partly responsible for this mess this letter is my attempt to explain my role in what happened in the hope that nothing like it will ever happen again the syndicate was a government initiative to prepare for a world in which encryption will be so secure that no one can crack it that world is almost here and the quantum technology revolution is likely to give birth to it soon if nothing changes privacy will be absolute and so will secrecy how you feel about that depends a lot on who you are and who you think has most to gain i was neutral but when my friend martin suggested that we could adapt some of the technology we developed for the ligo project i was excited at the possibilities our plan was to build behavioural template filters to track group activities on the web originally we hoped to model the spread of ideas martin was interested in the marketing angle and saw it as a way of selling products by understanding how memes propagate i was more interested in understanding how political ideas spread through a population it was a million miles from our real areas of expertise and i should have realised the dangers much earlier the war games department at dynamix saw the potential for this tool to be used as a twenty first century version of sigint allowing intelligence agencies and governments to track small group activities by matching online behaviour to known templates small groups including terrorist cells the pds syndicate had agents at just about every arms manufacturer in the west including dynamix when they became aware of our work they arranged for dynamix to recruit us on their intern scheme it was an amazing time we had every resource we could want and at first the freedom to do what we wanted gently they brought us round to working on small group dynamic tracking and following some of the recent tragedies i worked out for myself the potential of our software to detect and prevent terrorism but we needed data we called it the temp bank a database of behavioural templates which we would use to match against live online traffic to highlight areas of interest no one had ever worked on this sort of pattern based tracking before so we had no data on which to base the templates modelling communication patterns between members of a terrorist group without the templates it was impossible to carry out real time monitoring as the data rate was far too high for live analysis i raised my concerns with the head of research at dynamix and that was when i was introduced to someone from the syndicate they promised us data based on mathematical models developed by the department of defence and the project continued it was more successful than we had dared to hope a stream of high quality data filled the temp bank and the algorithm began to spot real world examples that closely matched the templates of course a lot of that was just chatter there is a world of difference between discussing and carrying out an attack and no security service can investigate every deluded fantasy online in order to find the one real plot dynamix were excited by what we had achieved but as the results rolled in they demanded more accuracy and for that we needed much better data the syndicate were happy to oblige and that is when i realised the how far they were prepared to go i tried to convince myself that the syndicate had access to a large database of existing communications that they were using to extract behavioural templates but the more i thought about it the more unlikely it seemed our software was seeing real world attack patterns that were suspiciously similar almost choreographed and i began to wonder if the pds syndicate were not just tracking terrorist activity but were encouraging it among groups that they had penetrated in order to build an encyclopaedia of behavioural templates that could be used to spot future attacks before they happened the syndicate had an achilles heel it was not possible to coordinate their research programme without leaving their own digital footprint martin and i refocused our efforts on tracking them down and found all the evidence we needed but they were the experts not us and we must have triggered an alarm somewhere they gave us one choice my death was now inevitable the only question was whether or not it would be faked once i was officially dead i would have no protection but we were valuable to them and that was the key to our survival i never knew the name of the girl they used to fake my suicide but they did assure me that she had died of natural causes i hope that much was true the syndicate were the real experts in espionage but martin and i had the edge in coding they watched us carefully but we managed to plant a virus in the database engine and it will have been triggered long before you read this it is designed to infect every copy of our algorithm and to encrypt crucial elements of the code rendering it unusable we learned a lot from studying stuxnet and the temp bank will suffer the same fate as the iranian centrifuges now the virus is released we convinced the syndicate to fund a hacker collective in norway and to allow martin to work there undercover as far as they were concerned he will be harvesting baseline data for noise filtering in social media traffic but he will be distributing this file and the virus to as many servers as he can without alerting them martin is good at this he has already hacked a number of back up company and app servers and used them as a distribution mechanism we have also been leaving a trail for the intelligence services we have no reason to believe the governments are connected with this and every reason to believe they may be our best hope of stopping them are we safe probably not or this insurance policy would have remained just that we might be on the run though unable to trigger the dead man switch that was keeping these files safe we do not plan on giving up and we urge you not to either'"
621 "execution_count": 28,
623 "output_type": "execute_result"
627 "keyword_decipher(c8text, 'dynamix', KeywordWrapAlphabet.from_last)"
632 "execution_count": 29,
638 "('mqjdbhzpoafrgtvnixkyseuclw', -17922.293053151883)"
641 "execution_count": 29,
643 "output_type": "execute_result"
647 "cipher_alphabet, score = monoalphabetic_break_hillclimbing_mp(\n",
648 " sanitise(c8text), workers=3,\n",
649 " max_iterations=20000, \n",
650 " plain_alphabet=cat(ltrs), cipher_alphabet=cat(ctls),\n",
651 " fitness=Ptrigrams)\n",
652 "cipher_alphabet, score"
657 "execution_count": 32,
665 "('dynamixzbcefghjklopqrstuvw', -17922.293053151883)"
668 "execution_count": 32,
670 "output_type": "execute_result"
674 "cipher_alphabet, score = simulated_annealing_break(\n",
675 " sanitise(c8text), workers=3,\n",
676 " initial_temperature=200, max_iterations=20000, \n",
677 "# plain_alphabet=cat(ltrs), cipher_alphabet=cat(ctls),\n",
678 " fitness=Ptrigrams)\n",
679 "cipher_alphabet, score"
684 "execution_count": 34,
692 "'if you are reading this then i may be dead again killed twice now by the post digital surveillance syndicate if i am still alive then you may be my only hope if they have killed me then this letter will have been distributed in unencrypted form to all the social media sites and all the news agencies in the world their name will be known to everyone and the story of what they tried to do will be headline news if not then my hope is that you will keep this quiet for now for your sake as well as for mine my name is jamelia dalmar and i am partly responsible for this mess this letter is my attempt to explain my role in what happened in the hope that nothing like it will ever happen again the syndicate was a government initiative to prepare for a world in which encryption will be so secure that no one can crack it that world is almost here and the quantum technology revolution is likely to give birth to it soon if nothing changes privacy will be absolute and so will secrecy how you feel about that depends a lot on who you are and who you think has most to gain i was neutral but when my friend martin suggested that we could adapt some of the technology we developed for the ligo project i was excited at the possibilities our plan was to build behavioural template filters to track group activities on the web originally we hoped to model the spread of ideas martin was interested in the marketing angle and saw it as a way of selling products by understanding how memes propagate i was more interested in understanding how political ideas spread through a population it was a million miles from our real areas of expertise and i should have realised the dangers much earlier the war games department at dynamix saw the potential for this tool to be used as a twenty first century version of sigint allowing intelligence agencies and governments to track small group activities by matching online behaviour to known templates small groups including terrorist cells the pds syndicate had agents at just about every arms manufacturer in the west including dynamix when they became aware of our work they arranged for dynamix to recruit us on their intern scheme it was an amazing time we had every resource we could want and at first the freedom to do what we wanted gently they brought us round to working on small group dynamic tracking and following some of the recent tragedies i worked out for myself the potential of our software to detect and prevent terrorism but we needed data we called it the temp bank a database of behavioural templates which we would use to match against live online traffic to highlight areas of interest no one had ever worked on this sort of pattern based tracking before so we had no data on which to base the templates modelling communication patterns between members of a terrorist group without the templates it was impossible to carry out real time monitoring as the data rate was far too high for live analysis i raised my concerns with the head of research at dynamix and that was when i was introduced to someone from the syndicate they promised us data based on mathematical models developed by the department of defence and the project continued it was more successful than we had dared to hope a stream of high quality data filled the temp bank and the algorithm began to spot real world examples that closely matched the templates of course a lot of that was just chatter there is a world of difference between discussing and carrying out an attack and no security service can investigate every deluded fantasy online in order to find the one real plot dynamix were excited by what we had achieved but as the results rolled in they demanded more accuracy and for that we needed much better data the syndicate were happy to oblige and that is when i realised the how far they were prepared to go i tried to convince myself that the syndicate had access to a large database of existing communications that they were using to extract behavioural templates but the more i thought about it the more unlikely it seemed our software was seeing real world attack patterns that were suspiciously similar almost choreographed and i began to wonder if the pds syndicate were not just tracking terrorist activity but were encouraging it among groups that they had penetrated in order to build an encyclopaedia of behavioural templates that could be used to spot future attacks before they happened the syndicate had an achilles heel it was not possible to coordinate their research programme without leaving their own digital footprint martin and i refocused our efforts on tracking them down and found all the evidence we needed but they were the experts not us and we must have triggered an alarm somewhere they gave us one choice my death was now inevitable the only question was whether or not it would be faked once i was officially dead i would have no protection but we were valuable to them and that was the key to our survival i never knew the name of the girl they used to fake my suicide but they did assure me that she had died of natural causes i hope that much was true the syndicate were the real experts in espionage but martin and i had the edge in coding they watched us carefully but we managed to plant a virus in the database engine and it will have been triggered long before you read this it is designed to infect every copy of our algorithm and to encrypt crucial elements of the code rendering it unusable we learned a lot from studying stuxnet and the temp bank will suffer the same fate as the iranian centrifuges now the virus is released we convinced the syndicate to fund a hacker collective in norway and to allow martin to work there undercover as far as they were concerned he will be harvesting baseline data for noise filtering in social media traffic but he will be distributing this file and the virus to as many servers as he can without alerting them martin is good at this he has already hacked a number of back up company and app servers and used them as a distribution mechanism we have also been leaving a trail for the intelligence services we have no reason to believe the governments are connected with this and every reason to believe they may be our best hope of stopping them are we safe probably not or this insurance policy would have remained just that we might be on the run though unable to trigger the dead man switch that was keeping these files safe we do not plan on giving up and we urge you not to either'"
695 "execution_count": 34,
697 "output_type": "execute_result"
701 "cipher_translation = ''.maketrans(cipher_alphabet, string.ascii_lowercase)\n",
702 "c8text.translate(cipher_translation)"
707 "execution_count": null,
715 "display_name": "Python 3",
716 "language": "python",
724 "file_extension": ".py",
725 "mimetype": "text/x-python",
727 "nbconvert_exporter": "python",
728 "pygments_lexer": "ipython3",