Friday, January 10, 2014

Continued Struggles Against the D'Agapeyeff Cipher

The end of 2013 brought with it yet another excursion into the depths of the D'Agapeyeff cipher for me.

75628 28591 62916 48164 91748 58464 74748 28483 81638 18174
74826 26475 83828 49175 74658 37575 75936 36565 81638 17585
75756 46282 92857 46382 75748 38165 81848 56485 64858 56382
72628 36281 81728 16463 75828 16483 63828 58163 63630 47481
91918 46385 84656 48565 62946 26285 91859 17491 72756 46575
71658 36264 74818 28462 82649 18193 65626 48484 91838 57491
81657 27483 83858 28364 62726 26562 83759 27263 82827 27283
82858 47582 81837 28462 82837 58164 75748 58162 92000

Or, as I like to think of it:

52251 21414 14544 44243 13114
42245 32415 45355 53355 13155
55422 25432 54315 14545 45532
22321 12143 52143 32513 33441
11435 45455 24225 15141 25455
15324 41242 24113 52444 13541
15243 35234 22252 35223 22223
25452 13242 23514 54512 2

It's interesting to reflect back to my first look at the D'Agapeyeff Cipher, and even though it's been over three years, I still feel the same about the potential ciphertext.

My main pieces of rationale have not withered over time:
  1. This book was published in 1939. Enciphering an approximately 200 character message by hand was still an arduous task. All example ciphers in his book were approximately 100 characters or less. Including an 89 character polybius square cipher produced by "a friend" which he solves in the Cryptanalysis section. Even this cipher contained 3 typos and one omitted letter.
  2. If I set aside the first piece of rationale, the distribution is far too flat for a message 200 characters in length.
  3. A 14x14 transposition square makes more sense with 196 digits, not 392. D'Agapeyeff himself suggested adding characters as nulls at regular intervals to thwart cryptanalysis. He also suggested looking for square shapes when transposition was in play.
If you are considering the original ciphertext, we can also pretty much rule out that fractionation was used. Think about it this way, what are the chances that the 9s only paired with 1s until the last column/row (depending how you write it out).

75 62 82 85 91 62 91 64 81 64 91 74 85 84
64 74 74 82 84 83 81 63 81 81 74 74 82 62
64 75 83 82 84 91 75 74 65 83 75 75 75 93
63 65 65 81 63 81 75 85 75 75 64 62 82 92
85 74 63 82 75 74 83 81 65 81 84 85 64 85
64 85 85 63 82 72 62 83 62 81 81 72 81 64
63 75 82 81 64 83 63 82 85 81 63 63 63 04
74 81 91 91 84 63 85 84 65 64 85 65 62 94
62 62 85 91 85 91 74 91 72 75 64 65 75 71
65 83 62 64 74 81 82 84 62 82 64 91 81 93
65 62 64 84 84 91 83 85 74 91 81 65 72 74
83 83 85 82 83 64 62 72 62 65 62 83 75 92
72 63 82 82 72 72 83 82 85 84 75 82 81 83
72 84 62 82 83 75 81 64 75 74 85 81 62 92

All this brings me back to the ciphertext I consider the working ciphertext:

52251 21414 14544 44243 13114 42245 32415 45355 53355 13155
55422 25432 54315 14545 45532 22321 12143 52143 32513 33441
11435 45455 24225 15141 25455 15324 41242 24113 52444 13541
15243 35234 22252 35223 22223 25452 13242 23514 54512 2

Around Christmas I did some more trials with all the variations of writing 196 characters into a 14x14 square and exactracting it. I ran these 48 x 47 = 2,256 ways of transposing the plaintext digits through a solver taking into consideration all possible shifts of the ciphertext. The idea came to me when contemplating whether or not the zero in the middle of the original ciphertext marked the true beginning of the cipher. I had done something similar in my last post on just the non-shifted ciphertext.

When nothing came of those "simple" transpositions  I went back to the columnar transposition idea in the 14x14 square (ADFGX) and ran that to get the max phi value for each of the possible 195 shifted ciphertexts.

The best phi values (~670) came when the ciphertext was shifted four positions from the starting point, or from the starting point of any of the 14 columns.

This collided with one of my other hypotheses to check, which is "what if the ciphertext got out of phase while he was copying it from the square to the final copy for the book?". Since it was a 14x14 square I couldn't imagine it wouldn't correct itself after one column or row. Perhaps a solution lies in that shifted ciphertext. I just haven't had time to pursue it yet.

One other hypothesis I've generated is to consider two rectangles were used for columnar transposition - one for the first coordinate in the pair and another for the second. In this hypothesis I would have either two 7x14s or two 14x7s to solve. It doesn't feel very simple and thus I don't want to touch it quite yet :)

I will say that I'm still intrigued by the prologue to this ciphertext:

Here Is A Cryptogram Upon Which The Reader Is Invited To Test His Skill

If I could pick only one key for 14 columns, I would use that one as a place to explore.