In a recent post, I mentioned the idea that the d’Agapeyeff cipher might involve a diagonal transposition on the 14×14 grid cryptologists suspect it may well have been based upon. To test this out a bit, I wrote a short C++ program (which I’ve uploaded here) which turns the number pairs into characters (for convenience) and prints out all four diagonal transpositions (forward, reverse, forward boustrophedon, reverse boustrophedon) starting from each of the four corners.

Because the number of doubled and tripled letters is a simple measure of whether a transposition is likely to be plausible or not, I counted those up as well. The next metric to calculate would be the unique letter adjacency count (i.e. how many unique pairs of letters appear for each ordering)… but that’s a task for another day.

Interestingly, transpositions starting from the top-left corner (and their reverse-order reflections in the bottom-right corner) have no triple-letters at all, as well as far fewer double-letters (9/10/11 compared to 13/14/15) than transpositions that start from the top-right. Though intriguing, I don’t know if this is statistically significant: I haven’t determined what the predicted doublet and triplet count would be for a totally randomised transposition, perhaps calculating that too that would be a good idea.

For any passing cryptologers, here is the ASCII version of the d’Agapeyeff cipher (as output by the C++ code) when arranged as a 14×14 grid (in numerical order but without J), followed by the 16 diagonal transpositions with their associated double & triple counts. My guess is that the top left corner reverse diagonal transposition (the second one down, starting “KBDMIDPIK…”) is most likely to be the correct transposition, but we shall see (hopefully!) if this is true…

K B M P Q B Q D L D Q I P O
D I I M O N L C L L I I M B
D K N M O Q K I E N K K K S
C E E L C L K P K K D B M R
P I C M K I N L E L O P D P
D P P C M G B N B L L G L D
C K M L D N C M P L C C C Y
I L Q Q O C P O E D P E B T
B B P Q P Q I Q G K D E K F
E N B D I L M O B M D Q L S
E B D O O Q N P I Q L E G I
N N P M N D B G B E B N K R
G C M M G G N M P O K M L N
G O B M N K L D K I P L B R

*** Top left corner ***
Forward order…
KDBDIMCKIPPENMQDIEMOBCPCLONQIKPMCQLDBLMCKLKCLEBQLMIKILDE
NPQDGNPELQNBBQONBLKNIIGNDDPCCNEKKIPGCPOIQPMBLDKMOOMMOLIO
PLOBKBBMNQMQELLPMSMGDNOGDCGDRNGBPBKPCLPKNGIMDECDLMBQDEBY
DPELQKTKOBELFIKNGSPMKILLRBNR
–> number of doubles = 11, number of triples = 0
Reverse order…
KBDMIDPIKCQMNEPBOMEIDQNOLCPCDLQCMPKILCKLKCMLBDLIKIMLQBEQ
LEPNGDQPNEIINKLBNOQBBNPIKKENCCPDDNGOMKDLBMPQIOPCGBKBOLPO
ILOMMOSMPLLEQMQNMBRDGCDGONDGMPLCPKBPBGNDCEDMIGNKYBEDQBML
TKQLEPDFLEBOKSGNKIIKMPRLLNBR
–> number of doubles = 9, number of triples = 0
Simple boustrophedon (forward then reverse)…
KBDDIMPIKCPENMQBOMEIDCPCLONQDLQCMPKIBLMCKLKCLDLIKIMLQBEE
NPQDGNPELQIINKLBNOQBBNGNDDPCCNEKKIPOMKDLBMPQIOPCGOMMOLIO
PLOBKBSMPLLEQMQNMBMGDNOGDCGDRPLCPKBPBGNKNGIMDECDYBEDQBML
DPELQKTFLEBOKIKNGSIKMPLLRNBR
–> number of doubles = 10, number of triples = 0
Reverse boustrophedon (reverse then forward)…
KDBMIDCKIPQMNEPDIEMOBQNOLCPCIKPMCQLDLCKLKCMLBEBQLMIKILDQ
LEPNGDQPNENBBQONBLKNIIPIKKENCCPDDNGGCPOIQPMBLDKMOBKBOLPO
ILOMMOBMNQMQELLPMSRDGCDGONDGMNGBPBKPCLPDCEDMIGNKLMBQDEBY
TKQLEPDKOBELFSGNKIPMKIRLLBNR
–> number of doubles = 9, number of triples = 0


*** Top right corner ***
Forward order…
OPBIMSQIKRDIKMPLLKBDDDLNDPLYQCEKOGCTBLIKLLCBFQNKPELCEKSP
OQKLBLPELIMMOLNNPDDQGRBIMCIBMEKDEKNKINLKGCOGMLNLRDKEMMNP
QBQBMBDECCDCIOIEKLCIPLOQMPBOPPPMQPLNGPIDKQQIQBMKCLPDODND
IBBONGLBNDMGKEBPMNENMMNCBGOG
–> number of doubles = 14, number of triples = 2
Reverse order…
OBPSMIRKIQPMKIDDDBKLLYLPDNLDTCGOKECQFBCLLKILBSKECLEPKNQI
LEPLBLKQOPRGQDDPNNLOMMNKEDKEMBICMIBRLNLMGOCGKLNIKBMBQBQP
NMMEKDLKEIOICDCCEDPOBPMQOLPICIPGNLPQMPPKMBQIQQKDDNDODPLC
LGNOBBIKGMDNBNMPBEMMNEBCNOGG
–> number of doubles = 15, number of triples = 1
Simple boustrophedon (forward then reverse)…
OBPIMSRKIQDIKMPDDBKLLDLNDPLYTCGOKECQBLIKLLCBFSKECLEPKNQP
OQKLBLPELIRGQDDPNNLOMMBIMCIBMEKDEKNRLNLMGOCGKLNIKDKEMMNP
QBQBMBLKEIOICDCCEDCIPLOQMPBOPIPGNLPQMPPDKQQIQBMKDNDODPLC
IBBONGLKGMDNBEBPMNMMNENCBOGG
–> number of doubles = 13, number of triples = 0
Reverse boustrophedon (reverse then forward)…
OPBSMIQIKRPMKIDLLKBDDYLPDNLDQCEKOGCTFBCLLKILBQNKPELCEKSI
LEPLBLKQOPMMOLNNPDDQGRNKEDKEMBICMIBKINLKGCOGMLNLRBMBQBQP
NMMEKDDECCDCIOIEKLPOBPMQOLPICPPMQPLNGPIKMBQIQQKDCLPDODND
LGNOBBIBNDMGKNMPBEENMMBCNGOG
–> number of doubles = 14, number of triples = 0


*** Bottom right corner ***
Forward order…
RNBRLLIKMPSGNKIFLEBOKTKQLEPDYBEDQBMLDCEDMIGNKPLCPKBPBGNR
DGCDGONDGMSMPLLEQMQNMBBKBOLPOILOMMOOMKDLBMPQIOPCGPIKKENC
CPDDNGIINKLBNOQBBNQLEPNGDQPNEDLIKIMLQBELCKLKCMLBDLQCMPKI
QNOLCPCBOMEIDQMNEPPIKCMIDBDK
–> number of doubles = 11, number of triples = 0
Reverse order…
RBNLLRPMKIIKNGSKOBELFDPELQKTLMBQDEBYKNGIMDECDNGBPBKPCLPM
GDNOGDCGDRBMNQMQELLPMSOMMOLIOPLOBKBGCPOIQPMBLDKMOGNDDPCC
NEKKIPNBBQONBLKNIIENPQDGNPELQEBQLMIKILDBLMCKLKCLIKPMCQLD
CPCLONQDIEMOBPENMQCKIPDIMDBK
–> number of doubles = 9, number of triples = 0
Simple boustrophedon (forward then reverse)…
RBNRLLPMKISGNKIKOBELFTKQLEPDLMBQDEBYDCEDMIGNKNGBPBKPCLPR
DGCDGONDGMBMNQMQELLPMSBKBOLPOILOMMOGCPOIQPMBLDKMOPIKKENC
CPDDNGNBBQONBLKNIIQLEPNGDQPNEEBQLMIKILDLCKLKCMLBIKPMCQLD
QNOLCPCDIEMOBQMNEPCKIPMIDDBK
–> number of doubles = 10, number of triples = 0
Reverse boustrophedon (reverse then forward)…
RNBLLRIKMPIKNGSFLEBOKDPELQKTYBEDQBMLKNGIMDECDPLCPKBPBGNM
GDNOGDCGDRSMPLLEQMQNMBOMMOLIOPLOBKBOMKDLBMPQIOPCGGNDDPCC
NEKKIPIINKLBNOQBBNENPQDGNPELQDLIKIMLQBEBLMCKLKCLDLQCMPKI
CPCLONQBOMEIDPENMQPIKCDIMBDK
–> number of doubles = 9, number of triples = 0*** Bottom left corner ***
Forward order…
GOGBCNMMNENMPBEKGMDNBLGNOBBIDNDODPLCKMBQIQQKDIPGNLPQMPPP
OBPMQOLPICLKEIOICDCCEDBMBQBQPNMMEKDRLNLMGOCGKLNIKNKEDKEM
BICMIBRGQDDPNNLOMMILEPLBLKQOPSKECLEPKNQFBCLLKILBTCGOKECQ
YLPDNLDDDBKLLPMKIDRKIQSMIBPO
–> number of doubles = 14, number of triples = 2
Reverse order…
GGONCBENMMEBPMNBNDMGKIBBONGLCLPDODNDDKQQIQBMKPPMQPLNGPIC
IPLOQMPBOPDECCDCIOIEKLDKEMMNPQBQBMBKINLKGCOGMLNLRBIMCIBM
EKDEKNMMOLNNPDDQGRPOQKLBLPELIQNKPELCEKSBLIKLLCBFQCEKOGCT
DLNDPLYLLKBDDDIKMPQIKRIMSPBO
–> number of doubles = 15, number of triples = 1
Simple boustrophedon (forward then reverse)…
GGOBCNENMMNMPBEBNDMGKLGNOBBICLPDODNDKMBQIQQKDPPMQPLNGPIP
OBPMQOLPICDECCDCIOIEKLBMBQBQPNMMEKDKINLKGCOGMLNLRNKEDKEM
BICMIBMMOLNNPDDQGRILEPLBLKQOPQNKPELCEKSFBCLLKILBQCEKOGCT
YLPDNLDLLKBDDPMKIDQIKRSMIPBO
–> number of doubles = 13, number of triples = 0
Reverse boustrophedon (reverse then forward)…
GOGNCBMMNEEBPMNKGMDNBIBBONGLDNDODPLCDKQQIQBMKIPGNLPQMPPC
IPLOQMPBOPLKEIOICDCCEDDKEMMNPQBQBMBRLNLMGOCGKLNIKBIMCIBM
EKDEKNRGQDDPNNLOMMPOQKLBLPELISKECLEPKNQBLIKLLCBFTCGOKECQ
DLNDPLYDDBKLLDIKMPRKIQIMSBPO
–> number of doubles = 14, number of triples = 0
 

 

 

20 thoughts on “The d’Agapayeff Cipher, continued…

  1. Scott Smith on December 22, 2009 at 3:24 pm said:

    Hi,

    I stumbled across your site looking for stuff on the D’agapeyeff cipher. I have now subscribed!!

    I’m tinkering with the D’agapayeff cipher and was very interested by your posts.

    I just don’t know if we’re giving Mr D’agapeyeff too much credit? The book itself is fairly basic and you would assume the challenge at the end would be at a similar level? Obviously “Basic” is not the same as “Easy to crack”!

    One of your comments in particular intrigued me. You say that triple letters in a row are extemely rare in English, but D’agapeyeff fields two of them in his cipher. I’m not so sure it’s that rare. I mean, even the few small lines in this paragraph have three english “Triples” in them!!! 🙂

    Thanks for your posts and website. I look forward to receiving the email updates.

    Scott

  2. If it was that simple, I’m sure that he would have remembered how he did it. 😉

    I think it more likely that it was a series of simple transformations, and that we’re actually pretty much on the right line. For example, the triples are a good indication (a) that there probably is some kind of transposition going on 🙂 , and (b) that there probably isn’t any polyalpha going on. 🙂

  3. Leaving a short note about this cipher.

    I’ve been working on it for a couple months now – off and on.

    I believe the pattern in the cipher is “man-made”. The 6-0s are nulls. The thought first came to me due to the zeros being used both as padding and as part of the 5×5 polybius square. That just did not sit right with me.

    What is is left is a series of 1s 2s 3s 4s and 5s written over a 14×14 grid. These have been transposed.

    Simply put, I believe that D’Agapeyeff unknowingly used the ADFGX cipher. He’s illustrated a version of it using the letters ABCDE on pg 124-126 of his original book.

    Mono-alphabetic substitution followed by fractionated transposition over 14 columns could easily stand up for 70 years, even without the ciphertext being disguised.

    Simple enough encryption and well within what D’Agapeyeff taught in his book. He had several mentions of adding nulls to a ciphertext to make cryptanalysis more difficult.

    Cheers,
    Jim

  4. Clues

    1. uses numbers
    2. Has the line up of rares on the right
    3. has the 04 and the 00’s suggest its two blocks of 14×14.
    4. has the triples across and down
    5. he can’t remember how it was done.
    6. its 61 to 65, 71 to 75, 81 to 85.. why ?

    What have a 5 x 5 ? to distract ? unless he does transpositions on the 5×5 with each character., then the simple substitution code is easily cracked. If two simple sequential substitutions are done after another ,its the same as one

    Even if the 5×5 is messed with at each symbol, eg interchage the index from horizontal to vertical,, How would the use of the 5×5 cause the right hand side to often contain rare symbols?

    Maybe the right hand side is a checksum, Well , the rest should have been decrypted if it was simple one for one substitution.

    Maybe its all base 6, which means to subtract 50 or 60 off the values and work with that.

    This makes sense as he is a mathematician ..

    Now with all the values returned to be 0 based, many mathematical functions could have as input and alphabet as output (that is, the output remains limitted to 26 or so glyph, and its reversible … 1:1 )

    eg differences, or addition and modulo, or multiplication and modulo
    The key could be a a large number A, then its (A * x ) Modulo 26. (if the alphabet is 0 to 25 ).

    Now, if its a big number, thats something that he can forget when he’s already thrown out the paperwork, on the basis he wouldn’t ever forget.. .. still why didn’t he give us the clue , because with a good clue on the algorithm, its far easier , or far more likely, to be close enough to do a hill climb..

  5. Hi Nick,
    I was trying to find some information about Alexander d’Agapeyeff (where did he come from, his date of birth …etc). After a lot of dead ends I found this web site

    http://discovery.nationalarchives.gov.uk/SearchUI/browse/C153
    1936-1992
    Records of Special Operations Executive

    On the right hand side of the web page look for and click on “HS 9”. This should lead to
    http://discovery.nationalarchives.gov.uk/SearchUI/browse/C15989

    Again on the right hand side of the web page look for and click on “HS 9/9”. This should lead to
    http://discovery.nationalarchives.gov.uk/SearchUI/browse/C11111609

    Once again on the right hand side of the web page look for and click on “HS 9/9/5 Alexander D’AGAPEYEFF – born 20.05.1900 or 1902”. This will lead to
    http://discovery.nationalarchives.gov.uk/SearchUI/browse/C9716335
    and
    http://discovery.nationalarchives.gov.uk/SearchUI/details?Uri=C9716335
    All this talks about an Alexander D’AGAPEYEFF who was he a member of the “Special Operations Executive” (SOE) from 1939 to 1946.
    What do you think? Is this the same Alexander D’AGAPEYEFF who wrote “Codes and Ciphers, an elementary book on cryptography”?
    If it is him:
    I think that he knew more about ciphers than we think.
    The D’AGAPEYEFF cipher could be a really nasty piece of work, difficult to decipher.
    Who was the book written for? New recruits?
    Was the cipher a test for recruiting?
    Etc …etc.
    What do you think? I would go to Kew Gardens but it is a long way from Sennece les macon!

    All the best
    Subtler Grilles (aka Russell)

  6. Russell: it seems extraordinarily likely that this was the same person, good find! 🙂 Next time I’m at the National Archives, I’ll definitely have a look at HS/9/9/5 (if Stu Rutter doesn’t get there first, which he probably will).

    I’d add that d’Agapeyeff’s book was published in 1939 (probably before he joined SOE), and the consensus seems to be that he probably didn’t know that much about ciphers before writing it. At the same time, I don’t recall seeing his name mentioned in Leo Marks’ “Between Silk And Cyanide”, so his role in SOE may well not have been cryptography-related. It would be interesting to see what the file says! Thanks for sharing that! 🙂

  7. Russell on December 31, 2012 at 8:44 am said:

    Great, I can’t wait.
    If Stu Rutter gets there first, will he give us a copy of the file?

    Happy New Year
    Russell

  8. Hi Russell, of course I will. I may get chance to go to Kew again sometime over the next couple of week.. I have plenty of crypto related files I’d like to look at, so I’ll add it to my reading list.

    I was unaware of the D’agapayeff cipher until I read Nick’s article, very interesting indeed. I will keep you both posted on this one.

    Cheers, Stu

  9. Russell on January 3, 2013 at 7:53 am said:

    Thanks Stu, I got just got the .zip from Nick (quick work !!!!)
    Russell

  10. Russell on January 3, 2013 at 7:58 am said:

    I forgot,
    http://en.wikipedia.org/wiki/CAP_Group
    do you think this is the same D’agapeyeff?

    Russell

  11. It could well be Russell, he seems quite the entrepreneur!

    What do you guys think about this: http://monkeyplayground.gather.com/viewArticle.action?articleId=281474981054022

    I can see a few errors like how did he come up with the sequences “8, 6, 7, 9, 0” and “2, 4, 5, 1, 3”, surely not by frequency as the second group would be “5,2,4,1,3”. And the nulls he has quoted seem intangible.

    It seems very much like he is trying to fit a square peg into a round hole with his logic, and wouldn’t transposing the letters as he has done by using the alphabet almost certainly produce the alphabet in return.. sort of like a double negative..

  12. Russell: I’ve read about d’Agapeyeff’s life from a different source, and that sounds like him. I didn’t know he coined the term ‘middleware’, though. 🙂

  13. Stu: was there a worksheet attached to the post explaining it all? (The post mentions one, but I couldn’t see it) If the guy is even remotely right, it looks like it could be tested in Excel in about ten minutes or so.

  14. Russell on January 3, 2013 at 6:04 pm said:

    Hi Nick, Stu,
    No it’s not the “man from CAP”, my mistake. In respect for his family I’ll send you some details by email. I would not like this to be published on a Web site.

  15. No Nick, I couldn’t find the worksheet when I looked..

  16. Russell on January 4, 2013 at 7:20 am said:

    Stu,
    For the worksheets see Nick.

    Russell

  17. Russell on January 4, 2013 at 8:00 am said:

    Hi all,
    It’s hard to see what he is doing (the worksheets make it harder !!).
    Why 8,6,7,9,0 and not 9,8,7,6,0. Also its 8 what?
    On his worksheet he has in the “A” column t=b and t=f ! Strange.
    There are 182 characters in his solution but there should be 196. 7% of the text is NULL is a bit hard to believe.
    For me the work sheet is just black letters written next to red ones.
    Look at http://tech.groups.yahoo.com/group/Dagapeyeff_Cipher/messages for the latest on this one.

    Russell

  18. Thanks for the worksheets Russel. As I expected his working would only ever end up producing the alphabet.. I felt compelled to write a blog post about it here.

    Stu

  19. Russell on January 4, 2013 at 8:08 pm said:

    Nice work Stu!!

    Russell

  20. If you believe that all the digits are used from the cipher, the plaintext would need to be written in some odd format to have such a flat distribution across the alphabet. And by odd, I mean planned. Sure the phi/IC checks out, but the distribution for a plaintext approaching 200 characters is not what I’d expect.

    If you believe that transposition was involved, what are the chances that all the 9s paired with ONLY 1s until that last row/column? (seems super unlikely, and yes, I realize super unlikely isn’t a scientific term).

Leave a Reply

Your email address will not be published. Required fields are marked *

Post navigation