Monday, 26 May 2008

The d'Agapayeff Cipher, continued...

In a recent post, I mentioned the idea that the d'Agapeyeff cipher might involve a diagonal transposition on the 14x14 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 14x14 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

No comments: