Caesars Box

Here is the ActionScript code to break the code
128-10-93-85-10-128-98-112-6-6-25-126-39-1-68-78.

function decodeCaesarsBox (sCode, sDelim, sDict) {
 var a = sCode.split (sDelim);
 var sBox = " ";
 var a2 = new Array ();
 var n = a.length;
 var iRoot = Math.sqrt (n);
 if (iRoot == Math.floor (iRoot)) {
  for (var i = 0; i < n; ++i) {
   sChar = sDict.charAt (Number (a [i])-1);
   sBox += sChar + "\t";
   if ((i+1)%iRoot == 0) {
    sBox += "\r ";           
   };
    a2.push (sChar);
  };   
 trace ("> Caesar's Box");
 trace (sBox);
 var a3 = new Array ();
 i = 0;
 var j = 0;
 while (a3.length != a2.length) {
  a3.push (a2 [i]);
  i += iRoot;           
  if (i >= a2.length) {
   i = ++j;
  };
 };
 trace ("> In Straight line");
 trace (a3.join (""));
 } else {
  trace ("Error, Caesar's box only works on perfect squares");
 };
};

128-10-93-85-10-128-98-112-6-6-25-126-39-1-68-78

Digital Fortress

So there are coupla Flash Developers and Internet Application Developers who shares similar taste of books with me. One challenge thrown to me was by one of my good friend, to break the code at the end of “Digital Fortress”.

I swear I never saw that before (I must have been too tired finishing the book in a day). 128-10-93-85-10-128-98-112-6-6-25-126-39-1-68-78

So, here it is, break this simple code, follows similar coding pattern as Dan Brown’s
19,15,20,12,12,16,13,19,2,5,1,13,
23,5,20,13,5,9,4,5,3,14,12,5,4

UPDATES

Caesars Box Code Breaker in ActionScript.

2006, 1st January: The code breaks down to as “Spam comments will be deleted”. The numbers represents the English Alphabet.