Tuesday, May 14, 2013

The spy strikes again

The Kings new Cartographer Samuel Ogilvy along with his daughter and grand children were now established in Whitehall Palace. The Palace was immense and the impression one has from the outside on how the Palace functions is no where near the reality.
The Palace has become a city within a city, behind the old granite walls lies the heart of the new Kingdom.
The Palace is being rebuilt and modernised, replacing the archaic layout that the High Lords had established with the palace grounds.
Most of the Government offices were established in one of the new wings of the palace, there were living apartments for many people who either worked in running the Government or in running the Palace.

The wing where Sam and his family had been placed was new, modern and very functional, it even had access to the park and playing area within the Palace walls. A school had been established for the children of the many functionaries that worked and lived within the palace walls.
Sam's place of work was in a completely separate area of the palace, this was in the Government offices and was a very heavily guarded area, Sam's office was at the far end of the long corridor on the second floor, from his windows he could look out over the wall and see part of the great city of London, not that there was much to see.
His office was simple, it consisted of a desk, several cabinets and a very large safe. It had a few books that had once belonged to his old friend Mathias Fleming, who had been the Kings last cryptographer until he was recently murdered.
He was murdered presumably by someone who hoped Mathias had kept the secret coded message that Sam now was now responsible for. The murdered clearly hoping Mathias held the code on his person or in his home where his body was found, a message so secret it had been coded using the Vigenere code. The Vigenere system has never been broken, poor old Mathias had tried, and he had been unsuccessful, but none the less he had been murdered because he tried.

Brother Andrew the man that had come to Sam's home to tell him Mathias was dead and that the King required him to take over Marathi’s task of code breaking often called in to see how Sam was doing, as well as to bring new coded messages that had been intercepted and required decoding. But always he would ask about THE coded message, each time Sam simply shook his head both in frustration and to let Andrew know he had not made any progress.
Most of the other codes that came into his office were simple codes, the messages usually were communications between commanders, some between Parliamentarian spies but all were mundane and not very informative.
Sam quickly learnt to tell the difference between field reports and spy reports by the quality of the paper used and the size of each message. Most would be a substitution code with a keyword which meant a cipher alphabet must be written down somewhere and that made substitution codes quite vulnerable.
One substitution code of average length would usually take Sam 2-3 hours to break, and when he ran out of work on the mundane codes he always turned to the real purpose of his task, to break the Vigenere code.
This morning Andrew knocked on the door as usual, Sam unlocked the door but instead of walking into Sam's office with more messages he said,
“Come with me”
“Where are we going” Sam asked.
“The King wants to see you” Andrew replied and waved Sam out of the room, Sam quickly gathered the documents on his desk and placed them back in the safe, locked the door of his office and the guard took position outside.
As they began the long trek to the Kings quarters Sam asked,
“Why are we going to see the King?”
Andrew simply replied,
“Because the King has asked to see you, that is all.”

It took them almost ten minutes to reach the Kings office, Andrew told Sam to wait outside while he went in, the Guards on duty outside the Kings door eyed Sam with some suspicion, the wait becoming quite awkward.
A young man came out of the office, clearly a man of nobility he had that arrogance and stiffness that such young men of the modern nobility carried around with them. He wore very elegant clothes and had a most unusual sword at his side, Sam presumed the young man may be a dueler or possibly be one of those young men in the palace who had taken up sword play or fencing as it was becoming known as.
He stopped when he saw Sam, nodded and said
“Good morning, I dont believe we have met, who are you?”
Sam wasn’t bothered by the abruptness of the young man, he simply smiled and replied,
“Sam Ogilvy”
“Well Master Ogilvy what is your business wandering the halls of the Kings Palace?”
“I am on the Kings business and apparently I am awaiting an audience with the King, and sir I dont believe I got your name.”
“I am Rodney Belmont, the Kings confidant and secretary, I was not aware the King had anymore appointments this morning.”
Sam recognised the name, Rodney Belmont was the eldest son of Lord Belmont and had been a student of Sam's at Oxford but clearly he didn’t recognise Sam out of the university environment. At university young Belmont was considered by most of the faculty as being a “proper prat”.
Before the conversation continued much further a young woman approached from the Kings end of the corridor, paused outside the Kings rooms, but then smiled at Sam and Rodney.
“Good morning, Rodney are you waiting on the King?”
Rodney replied
“No my lady I have just concluded my business with his majesty, when I came about Mr Olgivy hanging around the Kings doors, I was just enquiring in regard to his business in being here.”
Sam bowed to her, and smiled. The young woman returned the smile and said
“Though we havent met I have heard of Master Olgivy, I have met his daughter and grand children in the gardens yesterday.”
Rodney simply hummphed and said, “Well I have much to do and bowed slightly to the young woman and simply stormed off.
The young woman still smiling said
“I am sorry, we were not introduced I am Margret Hackett, you must not be offended by Rodney, you see he is an idiot and cannot help being stiff and rude.”
Sam now placed the young lady, Lady Margret was the daughter of Lord Hackett and soon to be married to the King.
“I was not offended in the least my Lady, I knew young Rodney when he was a student of mine at Oxford and he has not changed a whit.”
Lady Margret looked at the door to the Kings office, her smile dropping for a moment then said
“His Majesty is usually so busy these days, I had hoped to distract him away from his work this morning but I can see there is no chance, not if he has people lining up to see him.”
Just then Andrew opened the door and waved Sam to come in, seeing the woman there he bowed
“My Lady Margret, a rare pleasure”
Lady Margret smiled “As it is mine brother Andrew” and she then returned back down the corridor in the direction she had just come from.

Andrew quickly moved Sam into the Kings offices, they were large, huge by the standard of his own office and definitely more royal, and elegant, at one end was a large mahogany table and seated around the table were two men, one he recognised as the Prime Minister Edward Anders, the other Sam didnt know but noticed he wore the same gown as Andrew.

Andrew took Sam by the elbow and edged him closer to the desk, the King rose and before Andrew could do the introductions he said,
“So you are my new Cartographer, Master Ogilvy isnt it?”
“Indeed sire, correct on both accounts” Sam replied.
The King walked around the desk and stood before Sam,
“Mathias Fleming was beloved by us all here, beloved and highly valued; but he had left instructions that should anything happen to him we should seek you out, and now here you are master Ogilvy.”

The King then walked back to his desk, before he sat down he asked,
“Your family, are they comfortable?”
“Indeed Sire,”Sam replied, “very comfortable and very happy.”
The King sat down and looked to the Prime Minister,
“This gentlemen is the Honorable Edward Anders our Prime Minister.”. Edward Anders rose and shooks hands with Sam.
“We have met before Sire” the PM said, “I met Master Ogilvy when he and his family arrived at the palace on the first day.”

Then King then turned to the next man,
“This Gentlman is Brother Paul, believe it or not despite his grubby and disgraceful manner of dress he is in fact your employer.. Brother Paul looks after all my security and intelligence matters.”

Paul walked over to Sam, shook his hands and said
“I have heard many fine things about you Master Ogilvy, indeed many fine things and you are most welcome.”
As they shook hands Sam looked into Brother Paul’s eyes and immediately knew he should be afraid of this man, there was an aura around him that placed Sam's nerves on edge.
The King said,
“Why with brother Andrew and brother Paul here, I suspect you think my realm is run by a gaggle of Franciscan monks, and you know Master Ogilvy if you thought so I believe you might be correct.. We seem to have as many monks around here as we do soldiers. In fact I often have to remind people that this is a palace not a monestry.”

The King indicated that Sam should take a chair that was vacant, brother Andrew remained standing back near the door.
“Now Master Ogilvy Paul here tells me you have been most efficient in decoding the messages that have gone through your offices since you have arrived, and I am most pleased to hear this. But I am sure you know why I asked you here, I want to hear from you personally what you think about this message that has caused us so much angst and indeed considering poor Marathi’s demise so much sadness. Is there nothing you can tell us about it.”

“Well sire I believe the message was written in Europe, but for now the code still evades me.”

Paul interrupted Sam,
“Why do you say it was written in Europe?”
Because of the paper, the paper is definitely European, and is common in both France and the German states, also I believe the ink is possibly French.
The style of the writing in the message would suggest a personality that was proud, confident and a person that was well educated.”

The King said, “Well that narrows it down then, we are looking for a well educated European, how many of them can there be do you think Prime Minister?”

The King continued, “Well then can you tell us why this code is so devilishly difficult to break?”

“Sire the Vigenere Square as it is correctly known as is secure because it requires so many combinations to break it. This particular message has ten lines of text made up of four hundred and fifty six letters, forty five numbers and one hundred and thirty eight spaces. What makes this message so difficult is that normally a Vigenere Square does not include numbers, so their inclusion in the message is a unexpected surprise. At this stage I am assuming the numbers represent names, but they could be names of places or people. It is simply to soon to tell.”

The King nodded, “Well Master Ogilvy I am sure I do not need to tell you how urgent it is that we know what this message is about. Is their anything we can do to help you in the matter?”

Sam sat thinking for a moment and then asked
“Can you tell me about how the message was intercepted?”
Paul nodded, “We had been following a enemy courier for several weeks, in the hope he would lead us to other enemy contacts; he was a long distance courier and usually traveled between Dover and London , We know when he was in Dover he had access to Lord Hackett though we are reasonably certain the writer of the message was not Lord Hackett as we compared the handwriting, it was considerably different. Purely by chance the courier had an accident when returning to London, his horse stumbled and our men who had been following him rode up as to help him but he was found dead. They brought his body back here, and we found the message hidden in the pommel of the sword he wore.”

Sam then asked, “Is it possible I may see everything he wore and all the equipment he had on his horse, somewhere there must be a clue to the keyword. I say this because if this was just a normal courier, it is doubtful they would risk him memorizing it in case he forgot or as in this case something happened to him, somewhere they will have a symbol or word that will indicate the keyword.”

Paul said, “We can certainly have it delivered to your office master Ogilvy, but I assure you we and Mathias went over it all extremely carefully looking for that very thing.”

Sam nodded, “Well Brother Paul, I am sure it must be there so just one more look will not go astray.”

Paul said, “It will be done this morning”.
Sam nodded and then the King said,
“Well this has been most informative Master Ogilvy and I now feel more secure in the knowledge you are working on the problem, as Brother Paul said you will have all the equipment you asked for”

Having been dismissed Sam rose and bowed to the King and slowly backed out the door, once there Andrew whispered in his ear, “You don’t have to back out when in the Kings presence, once you have been dismissed you bow and simply turn and leave, the King realises you don’t have eyes in the back of your head, now come I will help navigate you back to your office.

The journey back was made in silence, Sam's head was spinning with all that had happened and when they turned the last corner of the corridor where Sams office was, Andrew grabbed his arm and pulled him back around the corner.
They both said at the same time “The guard isnt there”
Andrew told Sam to go back to the Guard rooms one corridor back and bring the guard up. Meanwhile from under his cloak Andrew drew a short sword, and made his way quietly to Sam's door, when he got there he found it was locked, and then for a moment realised he had likely made a huge mistake and possibly the guard had been called away, something he would be punished for.
There was a heavy thumping of feet on the corridor as 4 household Guards ran around the corner followed by Sam, when they got to he door Sam said
“The Guard has gone and the door is locked”
The officer in command of the detail said “Well he wouldn't just wander off, he had to have been led away or taken away”.

Sam unlocked the door of the office and walked in, there on the floor was the body of the guard, with blood flowing over the floor.

Paul said, “Well whoever did this had a key, and we know the guards don’t have any.” Then Paul and Sam both looked at the safe.
Sam went over and unlocked the safe, the document was missing.
Paul whispered “Good God, we have been humbugged they have taken the code.”

The Guards were busy inspecting the body of their comrade when a young but clearly a senior officer walked in with more Guards behind.
“What the hell is going on here? He demanded.
Paul and Sam stood up, Paul said to Sam,
“This is General Anders, commander of the Kings Guard,” he then turned to the General and said “Someone has broken into Master Ogilvy’s office while we were away and has stolen a most secret document out of the safe.”
The General surveyed Sam up and down and then looked at the body on the floor, he walked over to the door,
“It wasn't forced” he said.
“No general, I just unlocked it when we came back”
The General walked out into the corridor and went to the window at the far end, he then returned,
“Whoever did it, left by that window, and I am picking they will be well gone. But what is more worrying is it had to be someone the guard knew, because this office is at the end of a corridor, so anyone approaching had to be wanting access to this office, the guard would have been prepared to challenge anyone unless he knew them.”

Paul nodded, “So the murderer had to be someone in the palace, and someone most likely known to the Guards, general I want you to talk to the Guards who have been on duty and question them regarding everyone they have seen in the area today, and I mean everyone.”

The General nodded and then asked “Can you tell me the nature of the document that has gone missing, it may help if we should find it.”

Sam said “General would you ask your men to leave the office for a moment, you and Paul may stay of course.”

General Anders ushered his men out of the room, and once they had gone Sam went to the corner of the room where an old chair was placed, taking the chair over to the desk he tipped it upside down on the desk, taking one of the back legs he started turning the leg as it screwed out of the seat. Once the leg was completely unscrewed he stuck his fingers down its hollowed centre and pulled out a document.
“This is what they wanted, it is a coded message General”.

Paul looked at Sam stunned,
“But I saw you put the document in the safe Sam.”

“No Paul, Im afraid because I dont trust anyone here I never had the message out of its hiding place, what you saw was me placing in the safe was a faked copy of the message. I had to play the charade just in case of situations like this, or if someone had burst in while I was working on the code they would expect to see it, or if I had to suddenly leave the office as I did with you they would see me place what they assume is the document in the safe. Im sorry Paul but I had no choice.”

Paul and first scowled at not being trusted, and then smiled.
“You did very well Sam, very well indeed; and I dont blame you for not trusting anyone including me.”

General Anders looked at the chair, then the safe,
“So whoever stole the document had a key to this office, a key to that safe and now has a fake document, how long will it take them to realise they have been duped.”
Sam said “Well if its in the hands of the person it was meant for they will know instantly, otherwise it wont be known until they receive the message.”

General Anders then opened the door and spoke to the officer of the Guard,
“I want want you to get the carpenter, I want the window at the end of the corridor fastened permanently with bars.
There will be two guards from now on, one at the door of this office the other at the corner of the corridor, they will remain in sight of each other and they will allow no one other than myself, Brothers Paul and Andrew and of course Master Ogilvy to enter this corridor, and Lieutenant I mean no one; not even the King. Anyone demanding access to this corridor will be held and I will be summoned, is that clear?”

“Yes General” the young officer said and then disappeared to ensure the body of the guard was taken away and to get the men positioned.

General Anders then turned to brother Andrew,
“Well brother Paul it seems you and I have some things to discuss, it seems we have a very active spy-murderer loose in the palace.”
The two men turned to leave, The General stopped,
“Master Ogilvy I will have someone clean up the blood straight away, and from now on when you leave home for work in the mornings and return there when ever you must, you will be escorted by one of my guard, you are not to move around the palace on your own, is that clear.”

“Yes General very clear,”

Just then three Guardsmen came up the corridor with a bundle of clothing and saddles,
“We were told to deliver these to this office general.”

Sam nodded, “Yes please just put them in the corner, I will attend to them immediately.”
The General looked at Sam and the odd collection being placed in the corner,
“Master Ogilvy you are a very strange man.” he then left the office. Andrew just smiled, shrugged his shoulders and followed the General out.
Sam sat down his chair at the desk and sighed very deeply
“What a day this is turning out to be” he mused to himself, and it was not even midday yet.


  1. ooh. a mystery, a mysterious mystery. who dun it??? I think it was the Butler but that's only because the saying states so!!!

    what an ingenious idea to hide it in the leg of a chair! He better find a different place to put it now though. He cannot trust anyone. perhaps he should place it inside some joinery perhaps inside a cavity revealed when a bit of decorative woodwork is removed. that could be part of the wall or table of course, but I'd change the location now.

    as for the murderer, Sam better look out, but its odd, if they didn't kill him when he was in the office by himself, why would they kill him now. perhaps they need him alive. perhaps he is right to mistrust brother Paul... who knows

    a mysterious mystery indeed.

    its the butler, It's always the butler. the butler did it.

  2. Yes but which butler, the bleedin palace is full of culprits.

    1. we can narrow it down I guess. one that has many friends in the guard, one that is quite fit, one that has been seen communicating with strange people from outside the palace and the one which has the most butler like traits... I have no clue how you can be sure of any of that. but it one of them, it was the butler, in Sam's office with the knife!

  3. If Sam doesn't obtain another message with recognisably the same code, he might have a problem. A 'Vigenere' cypher in which the key is used once and never again is unbreakable without the key, especially if the key is a long one relative to the message length. A long key - a sentence or phrase - reduces the chance of repeated strings. Repeated strings will give you a likely key-length, which can help with identifying a word or phrase. In my view a 'random' bunch of letters for a key, though harder to memorize, is correspondingly harder to identify. (For a particular subscriber site I often visit, I have a 12 random character password that I long ago committed to memory. But then, I use it quite often).

    For all Sam knows, this message is a oncer, and the key, supposing it was not already in possession of the intended recipient, might have travelled with a different messenger. That message itself might be a code. E.g. 4110214. The recipient might already know that a message in this form is an instruction: Fourth Gospel (John), Chapter 11 Verse 2; 14 Characters. That's the key.

    The only clue is that the message includes spaces. I think I'd take a working assumption that the spaces represent spaces (though there seems to be quite a lot of them compared with the number of letters), and look for words of 1 2 and 3 characters, making certain 'working assumptions' about those. From then on it's trial and error country, laborious and time consuming.

    I think Sam had better hope that a second message with the same code comes his way...


    1. Barry: you have got me going on codes, and how one might send an instruction identifying the key to a coded message that will shortly arrive. Now, short messages are very hard to break, and as the thing is an instruction how to decypher a code rather than the code itself, might not yield meaningful answers. You have to guess.

      At that, I was wondering how to strengthen the above 4110214 instruction. You could add a couple of digits and rearrange, thus: 521441109. It means exactly the same thing, but the first digit tells you where in the string to start (5th digit, and loop back) and the last is a 'validation digit'. This v.d. is simply the sum of the others progressively until it becomes one digit (add 4+1...+0=18; 1+8=9. This digit is not of course part of the instruction, and so it is ignored for looping back purposes.

      At that, you could sent the key instruction embedded within the code, and letters become numbers. The first letter of the message represents the starting position of the instruction. So you message might go 'MXXXXXXXXXXXEDKBNXXXX...' where the Xs represent characters in the substantive code. M says 'instruction begins 13th character'. 'E' says instructions 5 character long (including the 'E'). 'D' is Gospel of St John; K is Chapter 11; B is Verse 2; 'N' is 14 characters. If you add a 'validation digit' (which would mean the 'E' becomes an 'F', then you can alert quickly whether this message is genuine or bogus.

      There is no real clue to a cryptographic analyst what the function of the first digit is. Only if the practices I have described here become commonplace and well known can the analyst conjecture that the code might have the key - or instructions how to find the key - embedded within it with an instruction how to find it.

      The key to this particular code is 'It was that Mary w...'

  4. LOL - Like you the code thing has hooked me up a little. originally it was simply going to be Sam breaking a code and end of story, but then I got to thinking which is always a bad thing for me. Anyway I will play around with it for a while, I also have a battle (solo) going on back in the Midlands, so all is rather busy at the moment.

    1. The re is always the chance that Sam will catch a break.... :-) For instance, I mentioned a repeated string within the message of three or more characters. The code cracker will work on the assumption that the repeated string represents the same characters. The key is unlikely to be as short as 1.2 or even 3 characters; but a 4-character string is not unlikely.

      For the sake of narrative, Barry, suppose you send me what the message is in plain, and I'll encrypt it. One thing, though: it will need a word (or a string of letters)of at least 4 letters, preferably 5 or 6, that is repeated.