“In truth,” he explained, with much excitement, “a brief glimpse of how I might solve it presented itself to my mind just a few days ago, but only very vaguely. But now I see that it is all to do with constants and functions, which is but a cruder system of my own fluxions.
“The code is based in part on a system that uses a single short and repeating word, known to both correspondents, as the key to the cipher. Let us say that the keyword is your own surname. The encipherer repeats this keyword beneath his message, thus.” Newton wrote two lines of text on a sheet of paper:
“Observe,” he continued, “how all the letters of the alphabet have a numerical value from one to twenty-six.”
“The letter T in our message is the twentieth letter in the alphabet,” he said. “We add this to the key letter that appears below. This is an E and the fifth letter in the alphabet. The sum of these two letters is twenty-five, which is the letter Y. This becomes the first letter of our cipher. Of course the sum of two letters may easily be more than twenty-six, for instance with the letters T and 5. Their sum is thirty-nine. Therefore, in order that we do not run out of cipher letters, we start the alphabet again so that after the letter Z, which is worth twenty-six, the letter A becomes worth twenty-seven, and so on. In this way, thirty-nine gives us the cipher letter M. When it is finished, the whole message in cipher would read as follows.”
“The person wishing to decipher the message,” continued Newton, “executes the procedure in reverse. He writes out the cipher with the key word repeating underneath, and subtracts their numerical values. E, worth five, is subtracted from Y, worth twenty-five, which gives us twenty. Twenty-six is then added, to take account of any minus numbers. This gives us forty-six and the letter T. Equally, if we look at the cipher word XUPAY, we see that if we subtracted our keyword letter S from the cipher letter A, we would end up with one minus nineteen, which gives us minus eighteen. Minus eighteen plus twenty-six is worth eight, which gives us the letter H, from the message word LIGHT.”
I nodded as, slowly, I began to understand the character of the cipher he described.
“As I said to you before,” explained Newton, “the code we have been dealing with here in the Tower is based on this general principle of a repeating keyword. But this makes it most susceptible to solution, for the key is always in full view of him who would make the decipherment. For example, you may perceive that in the cipher the letter X occurs twice in the cipher, and both times it conceals the same message letter L. Similarly the letter U occurs three times, and twice it conceals the message letter I. And it can be observed that one quarter of the time, common fragments such as the ‘TH’ in ‘THE’ will correspond exactly to ‘EL’ in ‘ELLIS.’ This is the weakness inherent in the system.
“Therefore the person who devised this key added an ingenious and numerical force that produced a motion within the key to hide those common fragments much more effectively. And yet so simple too, for the keyword itself changes based on the message, in a simple series progression. In this system, the keyword becomes a function of the letter L.
“The first five letters of the message would be encrypted in the normal way.”
“But for the next five letters, the key changes based on the five encrypted letters—Y,T,Q,U, and H—according to whether or not the letters of the encryption appear before or after L. Any encrypted letters between M and Z cause the keyword to be incremented by one letter. But any letters before or including L cause the requisite letter of the keyword to remain the same. Or, to put it another way, Ato L are our constants, while M to Z are our variables. For example, with:”
“Y occurs after E, which causes us to increment the keyword by one letter to F This is true of T, Q, and U, but not H, so that our next keyword becomes FMMJS. This gives us:”
“In the same way X, Q, and V modify the first three letters of our new keyword, FMMJS, so that it becomes G, N, N. But C and F being before L do not cause it to be incremented, and so we have a new keyword, GNNJS. Finally we end up with this:”
“To undo the cipher you subtract the numerical values of the keyword from the numerical value of the cipher and add 26 each time. For example, Y equals 25, minus E equals 5, gives us 20, plus 26 makes 46 which makes the letter T; similarly, the last letter of our cipher A equals 1, minus G equals 7, gives us minus 6, plus 26, makes 20 equals T.
“It was a most brilliant mathematical variation, for the system becomes almost inscrutable.”
“How did you solve it, sir?”