- The Perl Journal, Summer 1998
PREVIOUS  TABLE OF CONTENTS  NEXT 

The 3rd Annual Obfuscated Perl Contest

Felix Gallo

Summer is in the air, and young hackers' thoughts turn to writing gloriously awful code. And yes, despite our editors' protestations, despite the restraining order, despite even explicit medical advice from our therapists, we're once again proud to bring you the infamous, world-renounced Obfuscated Perl Contest.

The objective: to determine who can write the most devious, inhuman, disgusting, amusing, amazing, and bizarre Perl code.

The prizes: a lovingly manufactured trophy made of high durability space age materials, suitable for brazen display or shameful and secretive night burial. Also ord 'd' dollars. But wait! Before you rush to your keyboard to craft your outré æuvre, here are the categories in which you may enter:

1. MOST POWERFUL

This award is granted to the code which does the most with the least. The limit on bytecount is 512 characters, not including whitespace.

2. MOST CREATIVE

This award goes to the most stunningly intriguing or ridiculously hilarious combination of obfuscation and functionality. The limit is 1024 bytes of Perl code, not including whitespace.

3. BEST 'THE PERL JOURNAL'

In the fine 'just another Perl hacker' tradition, this award is given to the best code which generates the text 'The Perl Journal'. Case and context are unimpor-tant. The limit is 1024 bytes of Perl code, not including whitespace. In addition to these three categories, the judges will award one applicant the coveted and yet feared 'BEST OF SHOW' award.

THE RULES

  1. All programs must run under Perl 5.004.

  2. Programs may use only the functionalityincluded in the basic Perl distribution. Nothing beyond what's included in the standard distribution is available.

  3. Programs will be run on the judges' choice of platforms. The only guarantees about these platforms are that their interpreters pass make test, they have at least 4 megabytes of available user-space memory, and they have at least 1 megabyte of external storage. Programs may use whatever resources they find available beyond those limits, however.

  4. Submitted programs remain the credited property of the author, but may be duplicated, quoted, edited for style, and disseminated freely by The Perl Journal.

  5. All programs should be uploaded by anonymous FTP to tpj.com in the directory pub/orwant/obfuscated by August 10, 1998. The tar (or zip) archive must contain the following items:

    The archive should be named YOURNAME.CATEGORYNUM.ENTRYNUM.tar or .zip.

  6. The winners and their winning submissions will be announced in issue #11 of TPJ, in comp.lang.perl.announce, and on tpj.com. The 3rd Annual Obfuscated Perl Contest

HOW IT WORKS

As last time, judging will take place in three phases.

In the first phase, we'll read the README and then examine the program carefully in order to assess its aesthetics. Any code we actually understand at this point is probably not obfuscated enough.

In the second phase, we'll run the code, examine the output, and read the code again in light of its output. In the third phase, we will perform unnamed rituals with filters, pretty printers, debuggers, and whatever else we can think of to determine how the code works. Any code that we don't understand at the end of this phase is probably a winner, at which point we'll give up in tears and look at the SOLUTIONS file.

HINTS AND SUGGESTIONS

Judging obfuscation and what's 'cool', 'neat', or 'best' is a subjective process. However, here are some general guidelines which might help you design your entry.

Overuse of one particular obfuscation method risks being tedious. Entries which demonstrate breadth, range, and knowledge are likely to beat entries which rely on repeated parlor tricks.

Being clever and humorous is good. As an example, a past winner in the Obfuscated C contest (our pale, weaker cousin) formatted his code in the shape of a maze; the program read its own source code and implemented an ASCII 3D maze walking program.

Being surprising and deceitful is very good. Bonus points are awarded for obfuscated code which is not only syntactically obfuscated, but semantically obfuscated - code which appears to do one thing but does another is deemed extremely devilish.

Being poetic is also very good.

Entries needn't contain a #!/usr/bin/ perl (or equivalent), unless they use nonobvious command-line switches. Neither the #!/usr/bin/perl nor the command-line switches will count toward the character limits.

Programs which purposefully crash machines or cause system problems tend to be unamusing, so please consider saving them for the Perl system destroyers' contest.

The best examples of quality obfuscation are the winners from previous years. Some of the most notorious entries are shown at right.

SO THERE YOU HAVE IT

Please submit early and often, and encourage anyone you know who might be interested to do the same.

Although Perl has taken some hard knocks as being a write-only language (and this contest could be construed as an unabashed celebration of that fact), the intent of this contest is to demonstrate Perl's tersity and power, while at the same time giving the creative and demented minds of the Internet's legions a fun, intriguing playground. So have fun!

Although we do not accept entries via e-mail (FTP only, as above), questions regarding this contest should be directed to contest@tpj.com.

We look forward with some trepidation to seeing your code!

__END__

SELECTED WINNERS FROM PREVIOUS CONTESTS

Third Place, Most Creative, 1 st Annual Obfuscated Perl Contest: David Powell, for a curses-based real-time skiing game.

undef $/;open(_,$0);/ \dx([\dA-F]*)/while(<_>);@&=split(//,$1);@/=@&;
$".=chr(hex(join("",splice(@&,0,2))))while(@&); eval$”;

($C,$_,@\)=(($a=$/[1]*4)*5+1, q| |x(0x20).q|\||.chr(32)x(0x10).q$*$.
chr(0x20)x(0x10).(pack("CC",124,10)), sub{s/.\|(\s*?)(\S)./\|$1 $2/},
sub{s/\|(\s*?).(\S)/ \|$1$2 /}, sub{$2.$1.$3},sub{$tt=(3*$tt+7)%$C},
sub{$1.$3.$2});
while ($_) {
    select $/, undef, $/, $C/1E3;
    (sysread(STDIN, $k, 1),s/(.)(\*)(.)/(&{$\[(ord($k)-44&2)+2]})/e)
    if (select($a=chr(1),$/,$/,0));
	
print 0x75736520504F5349583B2024743D6E657720504F5349583A3A5465726D696F73
3B24742D3E676574617474722828303D3E2A5F3D5C2423292F32293B2024742D3E
365746C666C61672824742D3E6765746C666C6167267E284543484F7C4543484F4
7C4943414E4F4E29293B2024742D3E7365746363285654494D452C31293B24742D
E7365746174747228302C544353414E4F57293B24643D224352415348215C6E223B0A;

  ($p?(/.{70}\|$/):(/^\|/))||(&{$\[3]}<$/[0])?($p=!$p):&{$\[$p]}||die("$d");
  (&{$\[3]}<$/[1])&&(s/ \|$/\|/);
  (/\|.*\*.*\|$/)||die("$d");
}

Second place, Most Powerful, 0 th Annual Obfuscated Perl Contest: Gordon Lack, for a program that converts Mac-format text files into Unix-format text files.

#!/usr/bin/perl -w015l12pi.bak

First place, Best 'The Perl Journal', 1 st Annual Obfuscated Perl Contest: Joe Futrelle.

package S2z8N3;{
    $zyp=S2z8N3;use Socket;
        (S2z8N3+w1HC$zyp)&
    open SZzBN3,"<$0"
  ;while(<SZzBN3>){/\s\((.*p\))&/
    &&(@S2zBN3=unpack$age,$1)}foreach
   $zyp(@S2zBN3)
  while($S2z8M3++!=$zyp-
  30){$_=<SZz8N3>}/^(.)/|print $1
      ;$S2z8M3=0}s/.*//|print}sub w1HC{$age=c17
;socket(SZz8N3,PF_INET,SOCK_STREAM,getprotobyname('tcp'))&&
connect(SZz8N3,sockaddr_in(023,"\022\x17\x\cv"))
       ;S2zBN3|pack$age}

PREVIOUS  TABLE OF CONTENTS  NEXT