--- /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) \n",
+ "\n",
+ "import matplotlib.pyplot as plt\n",
+ "%matplotlib inline\n",
+ "\n",
+ "from cipherbreak import *\n",
+ "\n",
+ "c1a = open('1a.ciphertext').read()\n",
+ "c1b = open('1b.ciphertext').read()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(21, -1118.7370341550713)"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "key_a, score = caesar_break(c1a)\n",
+ "key_a, score"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "MARYAM,\n",
+ "IT IS GREAT TO HEAR FROM YOU. WE DID PICK UP SOME CHATTER A COUPLE OF MONTHS AGO AND J WAS MENTIONED THERE TOO, SO WE ALREADY HAVE A FILE ON HER. HER NAME IS JODIE AND SHE WORKS AS LIAISON BETWEEN THE BRITISH LIBRARY AND THE BRITISH MUSEUM, RESEARCHING LINKS BETWEEN ARTEFACTS AND IMPERIAL ROMAN TEXTS, SO THAT TIES IN WITH THE INTELLIGENCE YOU HAVE BEEN RECEIVING. NOTHING SUGGESTS THAT SHE HAS BEEN INVOLVED IN ANYTHING SHADY AND SHE HAS HELPED WITH SEVERAL INSURANCE FRAUD CASES. SHE HAS AN INTERESTING BACKGROUND. SHE DID A PHD ON HUMAN MIGRATION STUDIES, MAINLY MATHEMATICAL MODELLING, THEN MOVED ON TO STUDY KNOWLEDGE MIGRATION WHICH GOT HER INTO THE BIBLIOPHILE CIRCUIT. AFTER GRADUATING SHE SPENT SOME TIME WITH ONE OF THE LONDON AUCTION HOUSES WORKING ON PROVENANCE BEFORE TAKING HER CURRENT POSITION WITH THE LIBRARY. THERE REALLY IS NOTHING SUSPICIOUS IN HER BACKGROUND AND I WAS INCLINED TO WRITE HER OFF AS A LEAD, BUT WHEN I GOT YOUR MESSAGE I DECIDED I WANTED TO MEET HER. I TRIED TO SET THAT UP ONLY TO BE TOLD THAT SHE IS OUT OF COUNTRY FOR A WHILE. IN CAIRO.\n",
+ "I WILL SEE YOU THERE.\n",
+ "HARRY\n",
+ "\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(caesar_decipher(c1a, key_a))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "1113"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "open('1a.plaintext', 'w').write(caesar_decipher(c1a, key_a))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(9, -2106.6033294392596)"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "key_b, score = caesar_break(c1b)\n",
+ "key_b, score"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "'the shame of my esteemed and noble kinsmen gnaeus julius agricola is a story too often told in the taverns of rome for the entertainment of fools and cowards who never once left the safety of that great city the loss of the ixth legions standard in battle haunted him throughout his life and only his untimely death brought him relief and yet the full depth of his suffering is known only to a few and even i was not taken into his confidence until after his death the truth of the peril in which he placed the entire roman army was finally revealed to me in the paper she left to me in his will among them i found this despatch from sextus varus legatus of the ixth legion to gaius suetonius paul linus proconsul and governor of britannia describing the defeat of then in that camu lo donum at the writing of this message the iceni have successfully sacked the city including the temple of claudius where the procurators guard took their heroic final stand we were almost encircled by the enemy force who seemed possessed of the power to know our thoughts where we were strong they posted only holding forces where we were weak they attacked in strength and when reinforcements attempted to join us they were attacked on route we survivors owe our lives and our thanks to gnaeus julius agricola who in a time of great emergency recognised the strategy of the insurgent forces on our left flank and commanded our retreat with moments to spare due to this action the majority of our cavalry were saved along with the reserve forces all other frontline troops have been slaughtered and it is with great sadness and deepest anger i have to report that the ixth legion lost its aquila to the enemy i fear that if we are to save londinium and ver ulan ium from a similar fate we must find the strength to crush this rebellion if we fail then all of britannia is lost this much of agricola s story is widely known but the full truth must remain hidden for now and as remarked by my trusted slave and confidant tiro what better place to hide a book than among books'"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "wcat(segment(sanitise(caesar_decipher(c1b, key_b))))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "2058"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "open('1b.plaintext', 'w').write(wcat(segment(sanitise(caesar_decipher(c1b, key_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.5.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}