X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=2017%2F2017-challenge5.ipynb;h=214034c35df882d3d6b95cf25dfbd858af41537c;hb=d0a53e974970bc915d94280b5158b50f93054dc3;hp=39f3f8ff165b71f4c8771fd681975f67fcf6af2e;hpb=1f5b4b6137bad5506e623a048b31006774eefd5b;p=cipher-tools.git diff --git a/2017/2017-challenge5.ipynb b/2017/2017-challenge5.ipynb index 39f3f8f..214034c 100644 --- a/2017/2017-challenge5.ipynb +++ b/2017/2017-challenge5.ipynb @@ -160,7 +160,84 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('decoyzabfghijklmnpqrstuvwx', -4117.559010215594)" + ] + }, + "execution_count": 50, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cipher_alphabet, score = simulated_annealing_break(\n", + " sca_text, workers=12,\n", + " initial_temperature=200, max_iterations=20000, \n", + "# plain_alphabet=cat(ltrs), cipher_alphabet=cat(ctls),\n", + " fitness=Ptrigrams)\n", + "cipher_alphabet, score" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "maryam jodie has gone i arrived in selcuk as planned but she didnt make the rendezvous the local\n", + "station think she may have been kidnapped but there has been no ransom demand and there is nothing\n", + "much to go on her room had been ransacked and she left no message but something tells me she is ok\n", + "and we should move on i think she may have planned this meanwhile i have the document jodie wanted\n", + "from london i dont know how she knew but the fifth chapter was hidden in a cavity in a stone lintel\n", + "in some remains in the ephesus room at the british museum it was encrypted using another poly\n", + "alphabetic cipher invented in the nineteenth century i asked the museum to test it and the document\n", + "is authentic so i guess the imperial cipher school really had moved on perhaps i shouldnt have been\n", + "surprised after the discovery at bodrum but it leaves me wondering what else they developed one odd\n", + "feature was a frieze running round three sides of the lintel consisting of a single row of\n", + "blackandwhite tiles that the museum think were added in the roman period they read in sequence\n", + "wwbbwwwbwwwbwwwbwwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb www bbw\n", + "wwbw wbwbwbwbwbwbwbwbwbw bwbwbwbwbwbwbwbwbwbw bwbwbwbwbwbwbwbwbwbw bwbwbwbwbwbwbwbwbwwb www\n", + "bwbbbwbbbwbbbwbbbwb bbwbbbwbbbwbbbwbbbwb bbwbbbwbbbwbbbwbbbwb bbwbbbwbbbwbbbwbbbwb wwwb wwwb wwwb\n", + "wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb www\n", + "www www www www www www www www www www www www www www www www www www www www www www www www wwbw\n", + "wwbw www www www www www www www www www www www www www www www www www www www www www www www www\n", + "www wwwb wwwb www wb wwwb bbw wwww bbb wwwb wwwb wwwb www bw www bbb wwbw wwbw bbb www bbbb\n", + "wwbbbwwwbbbwwbbbwb www bwwwwbwbwwbwwbwwwbww www bwbwwbbwwbwwbwbwwwwb www bbw bbw\n", + "bwwbwwbwwwwwbwwbwwwb www wb www bwwwbwwbwwwbwbwwwbwb www wwbwwwbwbwbwbwbwwwb www bwwwbwbwbwbwwbwwbww\n", + "www bwwwbwwbwwwwbwwbwwwb www bbb bbw bbbb wwbw wwww bbb bbw bwbwbwbbbbbwwwbwwwbw wwbw bbbb ww bbb\n", + "www bbbb wwwb www wb www bwwwbwwbwwwbwbwbwwwb www wwbwwwbwbwbwbwbwwwb wwwb wwwb www bwb www wwbw\n", + "wwww bwbwwwwbwwwwbwwbwwwb www bwwwbwbwwbwwwbwwwwb www bwbwwbbwbwwwbwwwb wwwb www bwb www wwbw www wb\n", + "wwbw wwbw www bwwwbwwwbwwbwwwbwb wwwb www bbb wbwwwbwbwwwbwbwwwbww bbb wwbw wwbw bww www bbbb wwbw\n", + "wwbwbbbwwbbbwbwwwbww www www www www www www www www www www www www www www www www www www www www\n", + "www www www www www wwbw wwbw www www www www www www www www www www www www www www www www www\n", + "www www www www www www www www wbwwwbwbwwwbwwwbwwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb\n", + "wwwb wwwb wwwb wwwb wwwb wwwb www bwb www bwbwbwbwbwbwbwbwbwb wbwbwbwbwbwbwbwbwbwb\n", + "wbwbwbwbwbwbwbwbwbwb wbwbwbwbwbwbwbwbwbwb www bwwbbbwbbbwbbbwbbbwb bbw bbb wbbbwbbbwbbbwbbbwb bbw\n", + "bbb wbbbwbbbwbbbwbbbwb bbwbbbwbbbwwbwwwbwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb wwwb\n", + "wwwb wwwb wwwb www bwwwbwwwbwwwbwwbwwi have used b for the black tiles and w for the white ones it\n", + "took me a while to figure out that the frieze is steganography concealing the keyword for the cipher\n", + "in chapter five without jodie i am not sure where to go next there are only two possibilities as far\n", + "as i can see but i have no idea where one of them is and as far as i can tell no one else knows\n", + "either so i guess i will head for olympia see you there\n" + ] + } + ], + "source": [ + "cipher_translation = ''.maketrans(cipher_alphabet, string.ascii_lowercase)\n", + "print(lcat(tpack(segment(sanitise(ca).translate(cipher_translation)))))" + ] + }, + { + "cell_type": "code", + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -169,7 +246,7 @@ "'etoainhsrdlumwycfgpbvkxjqz'" ] }, - "execution_count": 9, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -181,7 +258,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -190,7 +267,7 @@ "'yrkfdlbqpoisjcumzeathwxgvn'" ] }, - "execution_count": 10, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -202,7 +279,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -236,7 +313,7 @@ " 'Z': 'f'}" ] }, - "execution_count": 11, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -248,7 +325,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -266,7 +343,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -346,7 +423,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -380,7 +457,7 @@ " 'Z': 'f'}" ] }, - "execution_count": 14, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -391,7 +468,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -425,7 +502,7 @@ " 'z': 'X'}" ] }, - "execution_count": 15, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -436,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -487,7 +564,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -496,7 +573,7 @@ "3362" ] }, - "execution_count": 17, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -507,7 +584,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -536,7 +613,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -545,7 +622,7 @@ "1577" ] }, - "execution_count": 19, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -556,7 +633,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -565,7 +642,7 @@ "1577" ] }, - "execution_count": 20, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -576,46 +653,46 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 49, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[' ** * * * * * * * * * * * * * * * * * * ** ',\n", - " ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ',\n", - " ' * *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** * ',\n", - " ' * * * * * * * * * * * * * * * * * * * * * ',\n", - " ' * * ',\n", - " ' * * ',\n", - " ' * * *** *** * * * * *** * * *** **** *** *** *** * ',\n", - " ' * * * * * * * * ** * * * * ** ** * * * * * * * * ',\n", - " ' * * * * * * * * * * * * * * * * * * * * * * * * * ',\n", - " ' * ***** **** * ***** * * * ***** * * * **** *** **** * * * ',\n", - " ' * * * * * * * * * * * * * * * * * * * * * * * ',\n", - " ' * * * * * * * * * ** * * * * * * * * * * * * ',\n", - " ' * * * * * *** * * * * * * *** * * * **** * * *** *** * ',\n", - " ' * * ',\n", - " ' * * ',\n", - " ' * * * * * * * * * * * * * * * * * * * * * * ',\n", - " ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ',\n", - " ' * *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** * ',\n", - " ' * * * * * * * * * * * * * * * * * * * * * ']" + "[' ⌷⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ',\n", + " ' ⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷ ⌷ ⌷ ⌷ ⌷⌷⌷ ⌷ ⌷ ⌷⌷⌷ ⌷⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷⌷ ⌷ ⌷ ⌷ ⌷ ⌷⌷ ⌷⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ',\n", + " ' ⌷ ⌷⌷⌷⌷⌷ ⌷⌷⌷⌷ ⌷ ⌷⌷⌷⌷⌷ ⌷ ⌷ ⌷ ⌷⌷⌷⌷⌷ ⌷ ⌷ ⌷ ⌷⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷⌷ ⌷ ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷⌷⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷⌷⌷ ⌷ ⌷ ⌷ ⌷⌷⌷⌷ ⌷ ⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷ ',\n", + " ' ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ',\n", + " ' ⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷⌷⌷ ⌷ ',\n", + " ' ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ⌷ ']" ] }, - "execution_count": 21, + "execution_count": 49, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "tt = ''.maketrans({'w': ' ', 'b': '*'})\n", + "tt = ''.maketrans({'w': ' ', 'b': '⌷'})\n", "chunks(bkeyt.translate(tt), 83)" ] }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -624,7 +701,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -633,7 +710,7 @@ "('fwruffnquevmp', -1750.4576000271347)" ] }, - "execution_count": 23, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -645,7 +722,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -654,7 +731,7 @@ "'nieyqmhcenwlqvchdporosweiohtsshreoihpsvrvusdcostmjezkdeytdhrtasupknropbklngeutgnssthjhhnowgbdwvucncdvofhbdltfpvobiuicirayodpwkpoutibtgcenuhpwachchnbrjydhsfvhqszeuvdcpswatvzmxhsiigkobvcagqcdikfstrvkfggbdkvcvstuvufienwiniasbcecmvdwemkwgtnsyjridowjamhuhnrvxssgewikqxpxhashvwvteulpavioctweavlhtikkkximoikdloikrwswfiojrynulrsgtoktknqcporlruoigivdpeddhrntdmrnucnrioiuetpdnftaipjrewjqtercxzvydhiswrtrneonknnfsyrifcdhedoweptjrechehcptdcehirohbcpniloorntrrrtohgeoandszehilxywfqkrgnphglvcojfbetcietpqmfetkalnahiwixdppersmrihrctseahkhtifbokasoozrjgvvkehjsufarunbrtiswzdmriwcrovhdsdeihdteiiustmjupvkhdiisibjloyrdpyxkusdlwfpsehvevdoiudppehzgvcewnhifrvkfggbdkbidptartnotloihpseehrdipeotmlwbcousicucctsktsrlritcanhpdmrehuinioiuuwirsxtanvjshfwyrkacfihfctdipytegvprdowhfldhycrqhfctswdbnagevitctsufsrofoccprycjgnifeikrthnowgcedfedjwiisdtihszeecfvlwjqgehoeicssaqflthagmncpvvifnreneoiioiulytddhuhkrtzsdpevphodehkctsvfhltophksiepsgcohnrnuseajettlhdwhiepjwcenbtbuecihpijncohouidiqjikpovimvsrfridohvchdporhrmhlpnikpacvjiswwgszeyxrcpragclkvxbporlruoigoviferifridicrskiporsyypwgprszenephnicczvttucvqesuiivqleesvfrhcfgchuswrocjslotcnxtiiswkoieatruninitradpaortylcouoahdpehgukcvlrmrafrntaovetrxvyinpenvniquglltisxgy'" ] }, - "execution_count": 24, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -665,7 +742,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -674,7 +751,7 @@ "('arcanaimperii', -1506.8637359274674)" ] }, - "execution_count": 25, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } @@ -686,7 +763,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 33, "metadata": {}, "outputs": [ { @@ -695,7 +772,7 @@ "'inhisjournaldatedtheidesofoctoberintheyearoftheconsulshipsofcaeceliustulliuscapitopomponianusplotiusfirmusandgaiuscorneliusgallicanusagricolawrotethemysteryofthebattleatcamulodonumisatlastsolvedcalgacusmaybeabarbariannowbuthewasaromancitizenthenwhobetrayedusallforloveofabarbarianithastakenallmyskillsasaleaderofmentokeephimalivethelegionnairesspendtheireveningsdesigningnewandcruelwaystoexecutehiminrevengefortheshamehebroughtuponusbuthislifeispreciousitistheonlycardlefttoplayinoursearchforsalvationandthereturnofthestolenaquilaeifwecanalsorecoverthecodexthenperhapsitslosscanbeconcealedandourliveswillbesparedreleasingtheromantraitorcalgacusmusthavestuckintheproudagricolasthroatbuthemadeapactwiththeremainingcaledoniiandtravellednorthtoexchangetheprisonerfortheaquilaeandthecodexbutthecunningcaledoniantribesmansetanothertrapandpresentedagricolawithaforgerycunninglyassembledwithpagesfromthebooksstolenwhenthetriberansackedmonsgraupiusfortoolongthesonsofromehadunderestimatedthepeopleinbritanniaandwhiletheaquilaofthelegionhadbeenrestoredbytheexchangetheirhonourwasnotagricolafacedareturntoromehumiliationandalmostcertaindeaththesixthchapterofmytaleofwoeisguardedbylightningbullandoak'" ] }, - "execution_count": 26, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -706,7 +783,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 34, "metadata": {}, "outputs": [ { @@ -715,7 +792,7 @@ "'a'" ] }, - "execution_count": 27, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } @@ -726,7 +803,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 35, "metadata": {}, "outputs": [ { @@ -735,7 +812,7 @@ "'zyxwvutsrqponmlkjihgfedcba'" ] }, - "execution_count": 28, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -746,7 +823,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 36, "metadata": {}, "outputs": [ { @@ -755,7 +832,7 @@ "'hveheifhbiicuzbbcfgvvnzafwnkqnndivxopvpdionrsyrmjvjlkaehbrfsmvmtvkqrrftcyspatroqqnbndcyiqretamkaszhcaqidtaxmpfrvenkfimmihgrxnvgqtrmcpzsqzpygininbbstddlcomipnnqgqargdgmrkbijtxnubxpuzjzbizesjbvqmutztdzotjzktjvraioamqznxiwnstbedizjnbjurebqqhldegrzvnynjbsdzprnparcknlqxnmryaisrqjxquzevdcijkzsbmmkczinszckaxrmkvnnzzfwlmksajvrzcqdrkqsdfgvyobqfemifqqrjcoilkydqodhdevxbauvrqdmumxaorieubzrdxvrlcowvodkrsqgzzsizvmdvddrnigrzayrlmednqfhqcblgnvrrntkusntzwdqpoddtvypazkhaqgqneyixiiukmcsfngyktqeftzpdmqtupjzjrkdxsunenxybyvqmqtdmfsdcmjkntbmmplvvvmzwvmzzzzcfymmtfumostdtbnzfkydvmddgrccdbjcnapbmmsrmjvtvztbcmmubemtzmdathxksrckiivczbkqzjvxbbyvqwjzzsinsowitztdzotjzenbyrumpsgbbvxopvgqwrcmfivmjtrjsponmsshdcmdrcmxombkjsopkydzblmhevxbkrcdllmuhranozrmdtidpmfedcbfvwkezzfvgrzxizrwkddefedcmrhtqizqzeqdcmtfcmuagskuoxceehvdbmkvqyiqreszfaqrdnxnmkrmwqgqqkekkieuozbrqmkrnvoizbwizihkukawixdzvbgmevxbtprrablnkvqgdbygzobrrqfzdcmsfnsprfncrxrpvespbsdhsrbvvjrbsbcynefqmilghcpeaqkbygwexspbramjbpmwdvgiatzcveonbzdzbbcfgvcojxcvhvyqusraxdireceehxdkuovylzkilefgvyobqfegiaaqdeeonbfidlyxfgvrhxprefmqgqhiuyiwlivipmasrtbdkfcznxbqcreoocieswonydyhwdtzrsqlmmmunvhwjkbmosmheqovbykgmphjsyprvxkvqwclksryojnnfdqpfgziqoyjpchoeszhetlptcrmllzw'" ] }, - "execution_count": 29, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } @@ -767,7 +844,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 37, "metadata": {}, "outputs": [ { @@ -776,7 +853,7 @@ "('zixzmzrnkvirr', -1506.8637359274674)" ] }, - "execution_count": 30, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -788,7 +865,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 38, "metadata": {}, "outputs": [ { @@ -797,7 +874,7 @@ "'inhisjournaldatedtheidesofoctoberintheyearoftheconsulshipsofcaeceliustulliuscapitopomponianusplotiusfirmusandgaiuscorneliusgallicanusagricolawrotethemysteryofthebattleatcamulodonumisatlastsolvedcalgacusmaybeabarbariannowbuthewasaromancitizenthenwhobetrayedusallforloveofabarbarianithastakenallmyskillsasaleaderofmentokeephimalivethelegionnairesspendtheireveningsdesigningnewandcruelwaystoexecutehiminrevengefortheshamehebroughtuponusbuthislifeispreciousitistheonlycardlefttoplayinoursearchforsalvationandthereturnofthestolenaquilaeifwecanalsorecoverthecodexthenperhapsitslosscanbeconcealedandourliveswillbesparedreleasingtheromantraitorcalgacusmusthavestuckintheproudagricolasthroatbuthemadeapactwiththeremainingcaledoniiandtravellednorthtoexchangetheprisonerfortheaquilaeandthecodexbutthecunningcaledoniantribesmansetanothertrapandpresentedagricolawithaforgerycunninglyassembledwithpagesfromthebooksstolenwhenthetriberansackedmonsgraupiusfortoolongthesonsofromehadunderestimatedthepeopleinbritanniaandwhiletheaquilaofthelegionhadbeenrestoredbytheexchangetheirhonourwasnotagricolafacedareturntoromehumiliationandalmostcertaindeaththesixthchapterofmytaleofwoeisguardedbylightningbullandoak'" ] }, - "execution_count": 31, + "execution_count": 38, "metadata": {}, "output_type": "execute_result" } @@ -808,7 +885,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 39, "metadata": {}, "outputs": [ { @@ -817,7 +894,7 @@ "'arcanaimperii'" ] }, - "execution_count": 32, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" } @@ -828,7 +905,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 40, "metadata": {}, "outputs": [ { @@ -859,7 +936,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 41, "metadata": {}, "outputs": [ { @@ -868,7 +945,7 @@ "1465" ] }, - "execution_count": 34, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -883,15 +960,15 @@ "metadata": {}, "outputs": [], "source": [ - "def beaufort_encipher(message, keyword):\n", - " \"\"\"Beaufort encipher\n", + "# def beaufort_encipher(message, keyword):\n", + "# \"\"\"Beaufort encipher\n", "\n", - " >>> beaufort_encipher('inhisjournaldatedtheidesofoctober', 'arcanaimperii')\n", - " 'sevsvrusyrrxfayyxuteemazudmpjmmwr'\n", - " \"\"\"\n", - " shifts = [pos(l) for l in sanitise(keyword)]\n", - " pairs = zip(message, cycle(shifts))\n", - " return cat([unpos(k - pos(l)) for l, k in pairs])" + "# >>> beaufort_encipher('inhisjournaldatedtheidesofoctober', 'arcanaimperii')\n", + "# 'sevsvrusyrrxfayyxuteemazudmpjmmwr'\n", + "# \"\"\"\n", + "# shifts = [pos(l) for l in sanitise(keyword)]\n", + "# pairs = zip(message, cycle(shifts))\n", + "# return cat([unpos(k - pos(l)) for l, k in pairs])" ] }, { @@ -911,7 +988,7 @@ } ], "source": [ - "beaufort_encipher('inhisjournaldatedtheidesofoctober', 'arcanaimperii')" + "# beaufort_encipher('inhisjournaldatedtheidesofoctober', 'arcanaimperii')" ] }, { @@ -920,32 +997,21 @@ "metadata": {}, "outputs": [], "source": [ - "beaufort_decipher = beaufort_encipher" + "# beaufort_decipher = beaufort_encipher" ] }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 42, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'inhisjournaldatedtheidesofoctober'" - ] - }, - "execution_count": 38, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "beaufort_decipher('sevsvrusyrrxfayyxuteemazudmpjmmwr', 'arcanaimperii')" + "# beaufort_decipher('sevsvrusyrrxfayyxuteemazudmpjmmwr', 'arcanaimperii')" ] }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 43, "metadata": {}, "outputs": [], "source": [ @@ -969,7 +1035,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 44, "metadata": {}, "outputs": [], "source": [ @@ -999,7 +1065,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 45, "metadata": {}, "outputs": [ { @@ -1008,7 +1074,7 @@ "('arcanaimperii', -1506.8637359274674)" ] }, - "execution_count": 42, + "execution_count": 45, "metadata": {}, "output_type": "execute_result" } @@ -1020,7 +1086,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 46, "metadata": {}, "outputs": [ {