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:
- Script can be at most 20 lines long and 35 characters wide (because the code ended up written in icing on a cake)
- The script must produce some sort of “good luck” message
- It needs to execute successfully and reliably
- 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
-
<html><body> -
<cfscript> -
data = -
"G!ouoody lsuscikm Klelv'ienW! "; -
letter = 1; -
function w(txt) { -
writeOutput(txt); -
} -
for ( letter = 1; -
letter lt Len(data); -
letter = letter + 2 ) { -
w( Mid(data, letter, 1) ); -
} -
for ( letter = Len(data); -
letter gt 0; -
letter = letter - 2 ) { -
w( Mid(data, letter, 1) ); -
} -
</cfscript> -
</body></html>
Script 2
-
<html><body> -
<cfscript> -
d = ",y,ss,m,',W,!!,n,ii,v,ee," -
& "kK,c,uu,lll, ,d,ooo,G"; -
g = "1,2,2,3,4,5,6,7,8,4,8,9,10," -
& "11,12,13,4,14,9,15,5,5,4,16," -
& "11,17,17,4,18,2,6,13"; -
a = ArrayNew(1); -
ArraySet(a, 1, 18, 1); -
-
function get(i) { -
var line = ListGetAt(d, 19 - i); -
WriteOutput(Mid(line, a[i], 1)); -
a[i] = a[i] + 1; -
} -
</cfscript> -
<cfloop list="#g#" index="idx" -
><cfset get(idx)></cfloop> -
</body></html>
Script 3
-
<html><body> -
<cfscript> -
d = "G,ooo,d, ,lll,uu,c,kK," -
& "ee,v,ii,n,!!,W,',m,ss,y"; -
g = "1,2,2,3,4,5,6,7,8,4,8,9,10," -
& "11,12,13,4,14,9,15,5,5,4,16," -
& "11,17,17,4,18,2,6,13"; -
a = ArrayNew(1); -
ArraySet(a, 1, 18, 1); -
-
function get(i) { -
var line = ListGetAt(d, i); -
WriteOutput(Mid(line, a[i], 1)); -
a[i] = a[i] + 1; -
} -
</cfscript> -
<cfloop list="#g#" index="idx" -
><cfset get(idx)></cfloop> -
</body></html>
Script 4
-
<ht<cfscript>p=true;r = -
RepeatString("o", 2);j=r&"dy lsu" -
&"scikm ";function w(m){if(p){p=0;w -
("ml> <body>"&"");}WriteOutput -
(m);}w(Reverse("oG"));d=j&" Klelv'" -
&"ienW";l=Len (d);s=l+-1*(l/ -
-l);function t (x){return x lt -
s;}function y(){for(l=1;t( l );l=l -
+Ceiling(Pi())/2){w(Mid(d,l,1));}}y -
();d=Reverse(d);w("! ");y(); w( -
Reverse("/<!u"));</cfscript>body > -
</html >
July 1st, 2005 at 12:41 am
Haha… Awsome idea!
July 6th, 2005 at 11:29 pm
I like script 4.
Nothing is better than taking code and mashing it together into a block of unreadable madness.
July 6th, 2005 at 11:37 pm
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.