Chapter 47. The Fifth Obfuscated Perl Contest

Felix Gallo

Nathan Torkington

The Introduction was written by Nathan, and the Results were written by Felix.

Twelve times the priest’s hand rises and falls, and twelve times the knife takes life from the white-clad sacrifice. Moonlight spills over the scene like the virgin’s blood over the altar, and your heart races. For you are next.

The priest turns to you, as the robed assistants carry away the last participant. Beneath the hood you can see only the priest’s sinister mouth, curved into a bitter smile. The crowd’s chanting increases in strength, and you take two paces forward.

“Have you an offering for L’rep Evif T’niop Xis, most holy giver of time and deliverer of all that is good?” The priest’s gravelly voice, eerily magnified by the stone platform and marble altar, makes your chest resonate and you feel the ball of fear in the pit of your stomach.

“Yes,” you say.

“Then step forward and deliver your offering to our most bloody god.”

You take another two paces forward, until you are at the altar. You can see the last supplicant’s blood still dripping, slowly, from the sides. You clear your throat and recite:

( $ ,, $ ")=("a".."z")[0,-1]; print "sh", $ ","m";;";;"

The crowd gasps, breaking off their chant. The priest does not say anything, silently moving his lips and frowning. The only noise that can be heard is the sound of blood drip drip dripping onto the stone platform. All are motionless, and then…

The priest gives a signal and cries: “Too simple! You’re indexing twice into the alphabet, and then printing three strings separated by the now-meaningful $,”. You feel the hands of the altar boys on your shoulders and know that all is lost.

Is this your fate, or will you defeat the high priests? Do you have what it takes to construct code most obfuscated? The doors to the Fifth Annual Obfuscated Perl Contest are open. The judges are straining at their straitjackets, and their medication has been boosted in anticipation of the finer degrees of psychosis required to decipher truly obfuscated code.

The categories follow:

Create a Diversion

Write a game in 512 characters or less, or a video game in 2048 characters or less if you use Perl/Tk.

World Wide Wasteland

Write a program that creates a web page most foul. You may use the CGI module bundled with Perl. The size limit is 512 characters.

Inner Beauty

The program with the highest utility * prettiness / size wins. Maximum 512 characters.

The Old Standby

Print The Perl Journal in 256 characters or less.

Results

In 1347, the Black Death swept across Europe, sowing the streets with the distorted bodies of the dead and driving fear-mad men to flagellate themselves with scourges in the desperate attempt to rid themselves of sin.

In 2000, The Fifth Obfuscated Perl Contest results arrived in my mailbox, with much the same effect.

72 entries, some spanning multiple categories, comprised this year’s plague. Clearly, the popularity of Perl amongst insane asylum inmates is on an exponential growth curve; debate the direction of causality amongst yourselves. The results are all available on the TPJ web site.

Create a Diversion

Nobody took this opportunity to implement Quake, which was too bad. Only two entrants went for Perl/Tk, probably because Tk is both object-oriented and longwinded about it. This category will exist in the next contest; the byte limit will be 4096 bytes, and no console graphics will be permitted.

In third place: Adam Spragg, whose nice, spare console graphics version of the skiing game was at least not another thrice-damned version of Mastermind.

In second place: Steve Lidie’s Tk game, featuring the chance to destroy The Perl Journal.

In first place, Garry Taylor’s heroic reimplementation of Frogger, which was obfuscated, obviously hellish to do, and fun to boot (Figure 47-1).

Frogger in 2048 bytes

Figure 47-1. Frogger in 2048 bytes

Garry’s code follows:

eval eval q.q>trd!Uj:%L<061:%C<csnvo:%f<fsddo0:%c<cmtd:%x<xdmmn
v:%I<011:%u<251:%bs<bsd`udSdbu`ofmd:%w<lnwd:%U<2:%t<L`hoVhoe
nv,?odv),idhfiu<?314-,vheui<?254(:%b<%t,?B`ow`r:%b,?bnoghftsd),vheui&
lt;?%u-,idhfiu<?311(:%b,?q`bj)(:s)3-3-%u-001-%c(:s)3-081-%u-311-%f(:s)3-001
-%u-031-%f(:s)3-1-%u-34-%f(:gns)%{<1:%{=%u:%{*<71(zs)%{-01-%{*51-54-%f-%
f(:|s)3-1-%u-04-cm`bj(:%b,?%bs)3-1-%u-311(:%G<,041:v)1-%L-31-C-%x(:v)%G-%L-
,021-C-%x(:%B<,91:v),31-041-,4-B-%c(:v),91-041-,74-B-%c(:%E<,%I:v)1-021-
31-E-%x(:v),%I-021-,91-E-%x(:%K<,231:v),71-81-,31-@-%C(:v),301-81-,%L-@-%C(
:v),%u-81-,211-@-%C(:%M<,%u:v),51-61-1-F-%C(:v),%L-61-,021-F-%C(:v),%u-61-,
211-F-%C(:%J<%u:v)751-41-791-[-%C(:v)401-41-441-[-%C(:v)%u-41-291-[-%C(:%b,
?bsd`udNw`m)063-080-091-088-,u`fr<?G-,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`#:%b,?%w)G-063,%y
-081,%x(:|rtc!SzP)cm`bj(:%R*<%^Z1:P)sde(:|rtc!Pz%b,?bsd`udUdyu)%L-9-,udyu&
lt;?%R/1-,ghmm<?%^Z1(:|rtc!sz%b,?%bs)%^Z1-%^Z0-%^Z3-%^Z2-,ghmm<?%^Z
5-,ntumhod<?%^Z4(:|rtc!Vz)%y-%x-%Y-%X(<%b,?bnnser)G(:|^chr($$/$$)x2016.

World Wide Wasteland

As the old programming adage goes, “Perl is the best language for managing a hardcore porn web site.” Oddly, an entrant named Mark Ryan took this to heart, submitting a porn ad generator…that was, unfortunately, clearly written and well-commented. On some level this is the most obfuscated entry ever received.

But, back to actual prizes. In third place: the enigmatically named ernimril and erkkah bring their combination fractal color generator/web browser load tester to the party (Figure 47-2). Don’t type 9 into the little box.

Sierpinski fractals in 504 bytes

Figure 47-2. Sierpinski fractals in 504 bytes

In second place: Jetro Lauha’s very pretty (and similar) math-based page-colorer. Most of the obfuscation is in the math, but the result is a cool graphics hack, shown in Figure 47-3.

In first place: Nemo, a redneck cracker from Georgia (with contestants like these, we don’t need to make stuff up), and his or her elegant sliding puzzle CGI script (Figure 47-4). Clever!

The code for the puzzle follows:

$0=s#.*[/\]##g;push@ARGV,"-h--Te_-JPerourl";$_=shift;@4=@1=@3=@2=@[=split(//);/
_/g;$;=pos;$$=sub{eval"($$\[$;],$$\[$"+$;])=($$\[$"+$;],$$\[$;]);
@[[$"+$;].=join"",@$ ;$\++"};$++;$;--;$"--;$;%4>0&&&$$;$"+=2;$;%4<
3&&&$$;$"-=5;$;>3&&&$$;$"+=8;$;<12&&&$$;$--;for(@[){s}(.)(.+)}<TD><a
href="$0?$2">$1</a>}g;s@^(.)$@<TD>$1@g;s]>_]> ]g}for(0..3){@[[$_<<
2]="<TR>".@[[$_<<2]};$$=localtime;print "Content-Type: text/html


<html><body><table border=2>",@[,"<TD>nal</table>$$<p></body>
</html>"
A sine plasma color generator in 503 bytes

Figure 47-3. A sine plasma color generator in 503 bytes

Inner Beauty

This category was for the most striking entry in the smallest size. It was very difficult to judge, partly because of, as always, perennial deranged foreigner Mssr. Bruhat. His “main” entry doesn’t qualify—but his “helper” entries are each fairly sweet.

An HTML sliding tile puzzle in 512 bytes

Figure 47-4. An HTML sliding tile puzzle in 512 bytes

The judges were divided, but in the end the third place prize was a tie between each of Bruhat’s four complying entries. Be sure to check them out for why.

The second place prize goes to Benjamin Young, whose automatic obfuscating machine escaped deobfuscation by the automatic deobfuscation machine through the systematic abuse of punctuation. The output of his program is even good enough to qualify!

#!/usr/bin/perl
$;="@{'`|;{'^'!.|-'}";$.++;$.++;$.++;$_="(.)?";/((?{$_.=$_}).)+$/;@_='~!@#$%^&*(
)_+`-=[ ]\{}|;':",./<>? '=~/$_/;@_ _=$;=~/$_/;$_="(.)*?";/((?{$_.=$_}).)+$/;$Z-=
$Z;"$.$."-$Z;/((?{$_ _[$z]&&!("${_[$x]}"^"${_[$y]}"^"${_ _[$z]}"^"$Z")&&($a.=$_[$x
],$b.=$_[$y],$z++);$x++;$y+=!($x%="$.$.");$y%="$.$.";}).)+/;$_="^"^"^";$_ _=".>.
@[$_>\$_?)@$_/^/";$_ _ _ ="^[\,{-[|"[@% ^/$_";$_='$_="^"^"^";`@{['."('$_ _$a'^
'$_ _ _$b')".".('!@/"'^'}.')".']}`';

print;

The most beauteous entry was formulated by Christopher Gutteridge, whose ASCII timepiece sprung a few gears on cygwin32 but was good enough under Linux to win through. It’s shown in Figure 47-5.

The Old Standby

Although Mssr. Bruhat’s combination PostScript/Perl (yes, really) entry was The Best Ever, it was also many, many more bytes than permitted. Alas. In fact, many deeply skilled entrants went over; we apologize, and next year, the byte limit will be 1024 bytes.

Third place: Matthew Smith, whose evolving string was cleverly done.

An animated ASCII timepiece in 511 bytes

Figure 47-5. An animated ASCII timepiece in 511 bytes

Second place: Mark Jason Dominus, who sent characters spewing every which way through multiple twisty little passages in the kernel, all alike. As solid a first entry as one might expect from a golden-age-of-talk.bizarre refugee:

@P=split//,".URRUUxR";@d=split//,"
lanruoJ lreP ehT";sub p{@p{"r$p","u$p"}=(P,P
);pipe"r$p","u$p";$p++;($q*=2)+=$f=!fork;map{$P=$P[$f|6&ord$p{$_}];$p{$_}=/$P/i?
$P:close$_}%p}p;p;p;p;p;map$p{$_}=~/[P.]/&&close$_,%p;wait
until$?;map/r/&&<$_>, %p;print$d[$q]

First place: there’s always someone who tries something totally beyond any understanding. That someone was Les Peters, who used a rendition of rotated 90 degree Mayan numerals to extract the required text. Yes, indeed. For this effort above and beyond the tethers of sanity, Les wins the hated and feared Best of Show award this year. Commiserations and sorrow go out to Les, his coworkers, and his family for the following code:

#:: ::-| ::-| .-. :||-:: 0-| .-| ::||-| .:|-. :||
open(Q,$0);while(<Q>){if(/^#(.*)$/){for(split('-',$1)){$q=0;for(split){s/|
/:.:/xg;s/:/../g;$Q=$_?length:$_;$q+=$q?$Q:$Q*20;}print chr($q);}}}print"
";
#.: ::||-| .||-| :|||-| ::||-| ||-:: :|||-| .:|

That’s all for this year! We go now to clean our hands obsessively and rest up for next year’s onslaught….

—The Obfuscated Perl Contest Judges

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset