--- /dev/null
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import os,sys,inspect\n",
+ "currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n",
+ "parentdir = os.path.dirname(currentdir)\n",
+ "sys.path.insert(0,parentdir) "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from cipher.caesar import *\n",
+ "from cipher.affine import *\n",
+ "from support.text_prettify import *"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "ca = open('2a.ciphertext').read()\n",
+ "cb = open('2b.ciphertext').read()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "11 7 True \n",
+ "\n",
+ "Meg, I took a look at the file you sent over and it was just a rotation cipher applied to the text.\n",
+ "At first it was hard to say if that was a bug or a feature and normally I would assume bug, but it\n",
+ "seemed odd that it was the only file that was affected so I asked around to see if anyone had seen\n",
+ "anything similar. It turns out that this was not the first navigation problem to hit the programme.\n",
+ "Gene reported a major issue with the guidance programme for Snoopy on the Apollo Ten mission which\n",
+ "could again have caused a major problem. For some reason the programme controlling the landing radar\n",
+ "wasn’t updated with the flight plan and if Gene hadn’t raised that with Iverson then the boys might\n",
+ "have had real trouble getting back. I looked through the company files and found another of our\n",
+ "mysteriously formatted reports: the memo informing them about the change, which explains why the\n",
+ "programme never got updated. This time the cipher was an affine shift, so slightly harder to crack,\n",
+ "but nothing serious. Still, it is much less likely that it was a bug that time, and in any case\n",
+ "twice is too much of a coincidence. It did start me wondering why the second cipher was easier to\n",
+ "crack than the first, but then I realised that the affine shift was too much of a giveaway. A\n",
+ "rotation cipher really could just be an encoding error, but the affine shift is too sophisticated\n",
+ "for a mistake, so whoever mangled the reports must have realised they had made a bit of an error\n",
+ "with the first one and tried to cover their steps with the second. It is hard to see this as\n",
+ "anything other than attempted sabotage, but I am not sure what the motive could be. I doubt it is\n",
+ "personal. The Apollo Ten and Eleven crews don’t overlap, so either someone has a grudge against the\n",
+ "whole Astronaut corps or they are trying to derail the Apollo programme. It could be the Soviets I\n",
+ "suppose. At first, I thought that their willingness to shift the LUNA-FIFTEEN orbit showed that they\n",
+ "weren’t part of it, but someone in the State Department pointed out that they might just have had a\n",
+ "guilty conscience, or been keen to distance themselves once the plot was discovered. I am still not\n",
+ "sure. In the meantime, could you take a look at the computer files to see who might have had access\n",
+ "to both memos, and who might have had the opportunity and means to doctor them? I am flying back to\n",
+ "Langley tonight, to see if the State Department have any ideas what might be going on. Neil said he\n",
+ "could fly me up in one of the NASA chase planes, which is something I have been keen to try. I will\n",
+ "call you if I get anything.\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "2592"
+ ]
+ },
+ "execution_count": 30,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "(m_a, s_a, o_a), score_a = affine_break(ca)\n",
+ "print(m_a, s_a, o_a, '\\n')\n",
+ "print(lcat(tpack(affine_decipher(ca, m_a, s_a, o_a).split())))\n",
+ "open('2a.plaintext', 'w').write(lcat(tpack(affine_decipher(ca, m_a, s_a, o_a).split())))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "3 8 True \n",
+ "\n",
+ "Apollo Ten\n",
+ "Spacecraft Operational Trajectory\n",
+ "First Revision\n",
+ "This document contains updated information about the planned lunar orbital operations for the mission and has been compiled to satisfy flight crew/flight controller training and simulation requirements.\n",
+ "\n",
+ "The following mission phases remain UNCHANGED from the original plan:\n",
+ "Launch, which ends with insertion into earth parking orbit (EPO).\n",
+ "Earth orbit coast, which ends with Translunar Injection (TLI).\n",
+ "Trans Lunar coast, which ends with Lunar Orbit Insertion (LOI).\n",
+ "Trans Earth coast, which ends with re-entry into the mid-Pacific recovery area.\n",
+ "\n",
+ "The total mission duration will be approximately EIGHT days.\n",
+ "\n",
+ "The report includes significant changes to Lunar orbital operations, which start at LOI and end with Trans Earth lnjection. NOTE THESE IMPORTANT TRAJECTORY CHANGES\n",
+ "\n",
+ "The prime objective of the LOI-TEI phase will be to demonstrate all\n",
+ "components of Mission G except those which directly involve Lunar Module powered descent and powered ascent.\n",
+ "\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "1012"
+ ]
+ },
+ "execution_count": 29,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "(m_b, s_b, o_b), score_a = affine_break(cb)\n",
+ "print(m_b, s_b, o_b, '\\n')\n",
+ "print(affine_decipher(cb, m_b, s_b, o_b))\n",
+ "open('2b.plaintext', 'w').write(affine_decipher(cb, m_b, s_b, o_b))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.8"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
--- /dev/null
+Meg, I took a look at the file you sent over and it was just a rotation cipher applied to the text.
+At first it was hard to say if that was a bug or a feature and normally I would assume bug, but it
+seemed odd that it was the only file that was affected so I asked around to see if anyone had seen
+anything similar. It turns out that this was not the first navigation problem to hit the programme.
+Gene reported a major issue with the guidance programme for Snoopy on the Apollo Ten mission which
+could again have caused a major problem. For some reason the programme controlling the landing radar
+wasn’t updated with the flight plan and if Gene hadn’t raised that with Iverson then the boys might
+have had real trouble getting back. I looked through the company files and found another of our
+mysteriously formatted reports: the memo informing them about the change, which explains why the
+programme never got updated. This time the cipher was an affine shift, so slightly harder to crack,
+but nothing serious. Still, it is much less likely that it was a bug that time, and in any case
+twice is too much of a coincidence. It did start me wondering why the second cipher was easier to
+crack than the first, but then I realised that the affine shift was too much of a giveaway. A
+rotation cipher really could just be an encoding error, but the affine shift is too sophisticated
+for a mistake, so whoever mangled the reports must have realised they had made a bit of an error
+with the first one and tried to cover their steps with the second. It is hard to see this as
+anything other than attempted sabotage, but I am not sure what the motive could be. I doubt it is
+personal. The Apollo Ten and Eleven crews don’t overlap, so either someone has a grudge against the
+whole Astronaut corps or they are trying to derail the Apollo programme. It could be the Soviets I
+suppose. At first, I thought that their willingness to shift the LUNA-FIFTEEN orbit showed that they
+weren’t part of it, but someone in the State Department pointed out that they might just have had a
+guilty conscience, or been keen to distance themselves once the plot was discovered. I am still not
+sure. In the meantime, could you take a look at the computer files to see who might have had access
+to both memos, and who might have had the opportunity and means to doctor them? I am flying back to
+Langley tonight, to see if the State Department have any ideas what might be going on. Neil said he
+could fly me up in one of the NASA chase planes, which is something I have been keen to try. I will
+call you if I get anything.
\ No newline at end of file