Is Dorabella a rotating pigpen…?

Posted by nickpelling on Mar 19th, 2009

Spurred on by a blog comment left this morning, I wondered whether the Dorabella cipher might actually (because of the symmetry of its cipherbet shapes) be some kind of rotating pigpen cipher, where you rotate each of the positions around after each letter. This would be a bit like a “poor man’s Alberti cipher disk”… just the sort of thing a self-taught cipher hacker such as Elgar might devise.

And so, I decided (being a programmer) to code it up. Of course, it didn’t appear to solve it (these things never do), but I thought I’d post my C code here anyway. Enjoy!


#include <stdlib.h>
#include <stdio.h>
char dorabella[] =
 "BLTACEIARWUNISNFNNELLHSYWYDUO"
 "INIEYARQATNNTEDMINUNEHOMSYRRYUO"
 "TOEHOTSHGDOTNEHMOSALDOEADYA";
#define ELEMENTS(N) (sizeof(N) / sizeof(*(N)))
#define DORABELLA_SIZE (ELEMENTS(dorabella) - 1) // trim the trailing zero!
void dorabella_encipher(int c, int *row, int *column)
{
 if (c >= 'V')
  c--;
 if (c >= 'J')
  c--;
 c -= 'A';  // c now equals 0..23
 *column = c % 8;
 *row    = c / 8;
}
int dorabella_decipher(int row, int column)
{
 int c = (row * 8 ) + column;  // space inserted to stop smiley being inserted!
 c += 'A';
 if (c > 'I')
  c++;
 if (c > 'U')
  c++;  // c now equals 'A'..'Z'
 return c;
}
int main(int argc, char **argv)
{
 int i, j, c;
 int row, column;
 int step_size = 1;
 if (argc > 1)
  step_size = atoi(argv[1]);
 for (i=0; i<8; i++)
 {
  printf("C%d: ", i);
  for (j=0; j<DORABELLA_SIZE; j++)
  {
   dorabella_encipher(dorabella[j], &row, &column);
   column += i + (j / step_size);
   while (column < 0)
    column += 8;
   column %= 8;
   c = dorabella_decipher(row, column);
   printf("%c", c);
  }
  printf("\n");
 }
 for (i=0; i<3; i++)
 {
  printf("R%d: ", i);
  for (j=0; j<DORABELLA_SIZE; j++)
  {
   dorabella_encipher(dorabella[j], &row, &column);
   row += i + (j / step_size);
   while (row < 0)
    row += 3;
   row %= 3;
   c = dorabella_decipher(row, column);
   printf("%c", c);
  }
  printf("\n");
 }
 return 0;
}

Leave a Comment




XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.