Obfuscation Contest

We had a going away party for one of my web programmer colleagues, and we had a competition to write the best and most obfuscated script that results in some sort of “good luck” message. Here were the rules:

  1. Script can be at most 20 lines long and 35 characters wide (because the code ended up written in icing on a cake)
  2. The script must produce some sort of “good luck” message
  3. It needs to execute successfully and reliably
  4. The winning script will be the best (reasonably) obfuscated one

I wrote four similar scripts that each output, between html and body tags, the text “Good luck Kevin! We’ll miss you!” All four scripts require nothing more than ColdFusion MX to run.

Script 1

  1. <html><body>
  2. <cfscript>
  3. data = 
  4. "G!ouoody  lsuscikm  Klelv'ienW! ";
  5. letter = 1;
  6. function w(txt) {
  7.     writeOutput(txt);
  8. }
  9. for ( letter = 1; 
  10.       letter lt Len(data); 
  11.       letter = letter + 2 ) {
  12.   w( Mid(data, letter, 1) );
  13. }
  14. for ( letter = Len(data); 
  15.       letter gt 0; 
  16.       letter = letter - 2 ) {
  17.   w( Mid(data, letter, 1) );
  18. }
  19. </cfscript>
  20. </body></html>

Script 2

  1. <html><body>
  2. <cfscript>
  3. d = ",y,ss,m,',W,!!,n,ii,v,ee,"
  4.  & "kK,c,uu,lll,     ,d,ooo,G";
  5. g = "1,2,2,3,4,5,6,7,8,4,8,9,10,"
  6.   & "11,12,13,4,14,9,15,5,5,4,16,"
  7.   & "11,17,17,4,18,2,6,13";
  8. a = ArrayNew(1);
  9. ArraySet(a, 1, 18, 1);
  10.  
  11. function get(i) {
  12.   var line = ListGetAt(d, 19 - i);
  13.   WriteOutput(Mid(line, a[i], 1));
  14.   a[i] = a[i] + 1;
  15. }
  16. </cfscript>
  17. <cfloop list="#g#" index="idx"
  18. ><cfset get(idx)></cfloop>
  19. </body></html>

Script 3

  1. <html><body>
  2. <cfscript>
  3. d = "G,ooo,d,     ,lll,uu,c,kK,"
  4.   & "ee,v,ii,n,!!,W,',m,ss,y";
  5. g = "1,2,2,3,4,5,6,7,8,4,8,9,10,"
  6.   & "11,12,13,4,14,9,15,5,5,4,16,"
  7.   & "11,17,17,4,18,2,6,13";
  8. a = ArrayNew(1);
  9. ArraySet(a, 1, 18, 1);
  10.  
  11. function get(i) {
  12.   var line = ListGetAt(d, i);
  13.   WriteOutput(Mid(line, a[i], 1));
  14.   a[i] = a[i] + 1;
  15. }
  16. </cfscript>
  17. <cfloop list="#g#" index="idx"
  18. ><cfset get(idx)></cfloop>
  19. </body></html>

Script 4

  1. <ht<cfscript>p=true;r             =
  2. RepeatString("o", 2);j=r&"dy  lsu"
  3. &"scikm ";function w(m){if(p){p=0;w
  4. ("ml>      <body>"&"");}WriteOutput
  5. (m);}w(Reverse("oG"));d=j&" Klelv'"
  6. &"ienW";l=Len        (d);s=l+-1*(l/
  7. -l);function t      (x){return x lt 
  8. s;}function y(){for(l=1;t( l  );l=l
  9. +Ceiling(Pi())/2){w(Mid(d,l,1));}}y
  10. ();d=Reverse(d);w("! ");y();     w(
  11. Reverse("/<!u"));</cfscript>body  >
  12. </html                            >

3 Responses to “Obfuscation Contest”

  1. Kyle Says:

    Haha… Awsome idea!

  2. Kevin Says:

    I like script 4.

    Nothing is better than taking code and mashing it together into a block of unreadable madness.

  3. Murdock Says:

    Yeah Kevin I don’t have any memory at all what the original code in script 4 was, or how it became the crazyness that it is.

Leave a Reply

You must be logged in to post a comment.