Chapter 45. The Third Obfuscated Perl Contest

Felix S. Gallo

Editor’s note: There was no Second Annual Obfuscated Perl Contest; we skipped it in order to shake off the zero-based indexing when the Zeroth Contest began in 1996.

The categories were Most Powerful, Most Creative, and Best “The Perl Journal”; we’ll skip directly to the results.

Oh, you shameless, malign bastards.

Coming so soon after Orwant’s cortex reconstruction therapy and my own first hesitant touch of a keyboard in months, the new brace of Obfuscated Perl Contest entries can only be taken as an unprovoked attack by a band of malicious sociopaths.

And it gets worse—most of the entries were submitted by new entrants. While this meant that some of the new players made first-timer mistakes, it also raises the spectre of an unending flow of new Obfuscated Perl programmers. As a result, we have gone into hiding from the U.N. War Crimes Tribunal. Humanity, we pray forgiveness!

But! We must judge on; we are, after all, professionals. Drawing on the lessons of the past, the judging team came up with brand new software for this round. Combined with the hard-won experience of the judges, this made this contest the most difficult and incisively-analyzed match in its history. And also the most brutal; when a Russian software munition formatted lovingly in the shape of a leaping dolphin doesn’t place, it’s a sign that the competition is fierce.

Many entries fell immediately to critical study and our gleaming machine. Here are the ones that survived and won; all entries and solutions are available on the TPJ web site. We strongly recommend that you check them out; many teach valuable lessons useful even for production code!

Most Powerful

Third Place: Tomas Rokicki and his implementation of a fast 20 x 80 version of Conway’s Game of life.

Second Place: Kevin Miller, whose program is a nicely obfuscated graphing calculator that plots arbitrary one-variable functions in ASCII.

First Place: Clifford Adams, whose Pure Perl implementation of two software munitions is jam packed, using some breathtaking space-savers. Added bonus: his patented Algorithmic Key Recovery System for RSA in the SOLUTION file. Capital. Clifford’s entry:

#!/usr/bin/perl -s0777
$_=<<'',s'3'(q))(e))l]'g,s']'|a-mn-z($)&|n-za-m$(&)|;'g,s'`'/g,s/'g,s/./$'/ee
#y]s/
#/`#/d(&bmul($`%/s-.|\n-`//-ge;`@(.)/;$$1=`4/pack("`$"/$'/ee
#(e)=1@_"0(x"@*0;$(x=ha4B*",4H*",z,$$..&*(&,&&&=~f-^0*-/qb 'ovtvag.cy'@"(a=~%
#@*)onq#*,16&,urk()&/@:$(q*2-1+("&>>1@;7k$1-(q*2+(:&@_<>.""k$(:-1&;!3(q?%(t
#?(e=():0,""-r:cevag(e;f!$.|a&{(:}!@_()@,1@"0;%@")onq#",256&,beq()&/@_(x;%@,
#)ozb#,,(,&,(*&,()?(,=)ozb#,,("&,(*&:9,""/@;~%$(,,("&=)oqvi$(,,256&@_4C",("&.
#(_,8/3cevag!tr

Dishonorable mention: Dave Hartnoll’s entry generates a very nice calendar; Dean Inada’s parenthesis balancer is cute; and Vipul Ved Prakash’s dolphin-shaped Russian cipher was barely squeaked out (you see, the new minimum requirement is two ciphers). Vipul’s program:

#!/usr/bin/perl -s
                                                      sub R{int$_[0]||
                              return vec$_[1],$_[2]/4,32;int$_[0]*rand}($R)
                           =$^=~'([]-`])';sub F{$u=0;grep$u|=$S->[$_][$_[0]>>
                              $_*4&15]<<$_*4,reverse 0..7;$u<<11|$u>>21}$t=$e
                               ||$d?join'',<>:(($p,$d)=($R,1),unpack u
                               ,"(3=MCV7%2W'<`");@b=@t=0..15;for(
                           ;$i<length$p;$i+=4){srand($s^=R$R,$p
                        ,$i)}while($c<8){grep{push@b  ,splice
                     @b,R(9),5}@t;$R[$c]=R(2       **32);@{
                $S->[$c++]}=@b}@h=0..7;@o       =reverse
              @h;while($a<length
            $t){$v=R$R,$t,$a;
 $w=R$R,$t,($a+=8)-4;
   grep$q++%2?$v
    ^=F$w+$R
     [$$R]:(                                       $w^=F$v+$R[$$R]),$d?(@h,(@o)
     x3):((                                        @h)x3,@o);$_.=pack N2,$w,$v}
     print

Most Creative

Halfway through the submission period, only two entries had been submitted. But the celebratory champagne went flat and the canapés congealed in our throats as these entries appeared in the download directory. Clearly the contestants had been timing their blows for maximum shock value.

Third Place: Mark James claims third place with the last entry that builds on the work of James Conway that will ever be accepted—a factoring program nicely (and obfuscatorily) formatted in the shape of π.

Second Place: Cayce Ullman, whose entry not only decodes Morse Code, but is partially written in Morse Code. Cayce, we want you to know that there’s help available for people like you. Cayce’s code:

#!/usr/local/bin/perl -0777
open(X,"<$0");@y=(5,67,70,22,1,43,25,40,4,53,
23,49,8,7,26,52,77,16,13,2,14,41,17,68,71,76)
;$_=<X>;for($z=0;$z<@y;$z++){$i=$y[$z];$d=@y+
1;$o='';for($n=0;$n<4;$n++){if(($i/$d)>=2){$o
.='-';}elsif(($i/$d)>=1){$o.='\.';}$i=$i%$d;
$d/=3;}$w{$o}=chr($z+97);$o=~s/\//g;$v{chr($
z+97)}=$o;}@x=split'_';pop@x;sub c{my$x=@_[0]
;foreach$p(keys(%w)){$x=~s/([^.-]|G)$p[s]/$
1$w{$p}/sg;}return$x;}$_=pop@x;$_=c($_);eval;
<<_
$. = <>;$.  = " $.  ";$-  =  -.-. ($. );$- =~
... !^... !!--. ;.--. .-. .. -. - "$- -. ";
$. =~ ... %... *(.-- *)... *%$1%;  .. ..-.
($.  . --.-  ".... . .-.. .--. --- ..- - " ){
.--. .-. .. -. -  ".. - ...  -- --- .-. ... .
-.-. --- -.. . :";..-. --- .-. . .- -.-. ....
$- (... --- .-. -  -.- . -.-- ... ( %...- ) )
{.--. .-. .. -. - "-. $- =$...- {$- } "; } }
_

First Place: Stephane Payrard’s Polyominos-fitting problem solver is very beautiful—eclipsed only by the entertaining reading available in the SOLUTION file. Perhaps it’s fitting that such a powerful obfuscatory statement comes from the land that bred semiotics, deconstructionism, and Jean-Paul Sartre. Or maybe Stephane is just demented.

Dishonorable mention: James Shute, who had us stumped until we realized he was cleverly bending the rules; and Stijn van Dongen, whose entry was fun, but unfortunately over the character limit.

Best “The Perl Journal”

The awesome might of our AI was unleashed on these contestants without mercy. And they fell; oh yes, they fell. Only a few entries of the original 18 required extensive human study. A great many tried to flaunt the whitespace rule and were disqualified for being obvious. Here, then, are the cockroaches of the category: the hardy, repulsive survivors.

Third Place Tie: Cameron Kaiser, for an old-sk00l ASCII art entry with many layers of chaff; and Jeff Pinyan, whose exhaustive exploration of the asterisk was particularly grotesque. Cameron’s entry:

$r="3131343130323131383033353131363131313131343131313132353034313132313132353132
32313130303436303437303438303439303530303531303532313239";
$|++;while($r=~s/([0-9]{6})/the perl journal/&&($s=$1)){push(@q,chr(pack("H6",$s
)-$g++));}while(<DATA>){/[JUNK^FOOD]/&&die"
";print$q[$_=~s/[$*]//g];}
__DATA__
        $                                        $        .
    $      $   .            $           *            $       .   *         $
                *              .
  $                    $              .                             $
         $         .                 *              .         *       $
    *
                               $$$  $$$$ $$$  $          .
                               $  $ $    $  $ $
                .              $$$  $$   $$$  $
                               $    $    $ $  $
______________________________ $    $$$$ $ $ $$$ ______________________________
                 .            /    /$$$$   | $$$                  $
   .       .           .     /    /         |         .      .
                .           /$$ /$$$$$$$$  $$           .
$    $   $$$$$$$$$         /   //                     .          *      $
   .     $  THE  $        /$$//$$$$$$$$$$$$$$ $$$    
         $  PERL $                                         $
   .     $JOURNAL$     .                    $      .     .      *
         $ 1998! $               *        .           $               .
         $$$$$$$$$

Here is Jeff Pinyan’s entry:

**=2;$#{*}=$**$*;%*=($*/$*,($**$**@**@*)-($***($**$*)),$*,
($**$**@**@*)+$**$*,@*-$*,($**$**@**@*)+$*/$*,$**$*,$***@*,
$**$*+$*/$*,$***($**$*)*@*,$**(@*-$*),($**$**@**@*)+$*/$*,
$*+@*,$**($**@**@*+@*+$*),$***(@*-$*),$**$**@**@*+($***(@*-$*)),
(@*-$*)**$*,$***@*,$**@*,$***($**(@*-$*))+$**@*,$**@*+$*/$*,
$**$**@**@*+@**$*+$*/$*,$**@*+$*,$***($*+@*)-(@*-$*)**$*-$*,
$**@*+(@*-$*),$**($**@**@*+@*+$*),$**($*+@*),$**$**@**@*+$**@*,
@**(@*-$*),$**$**@**@*-(@*-$*),$***($**$*),($**$**@**@*)+$***(@*-$*));

$_=<<'go//s/s';

                        ;)*%(sy  ek}b$>  =<a${tr
                           o     s    }     }
                           _     ${*$rh     c
                           {     p       a  m
                           +     t       nirp

go//s/s

$code=<<'Jeff Pinyan';

                        eval(sc  alar(re
                           v     e     r
                           s     e     [
                        s  /     s//og,
                        $  _     ]
                        -  >     [
                        1]))     ;

Jeff Pinyan

eval [$code=~s/s//og,$code]->[1];

Second Place Tie: Ken Rich, man of many quality entries, whose first entry was visually splendid; and Dan Rinehart, whose storytelling entry uses copious errors to work:

@a=qw/13 2 0 4 8 5 0 2 0 14 1 10 0 18 2 0 3 3 0 9 25 10/;
$^W=open(A,$0);$a=($_)=(join('',<A>)=~/("(.*?));/s);
s;[$@].;;g;s;[^a-zA-Z.]; ;g;s;s+; ;g;
${uc(pack'H6','736967')}{pack'H16','5f5f5741524e5f5f'}
=sub{$a=shift(@a)-1;print$_[0]=~/.{$a}(.)/};
s; .;.;gs;s;(.{1,60}s);print"
$1";ge;
@b=("Mr.","$TPJ","saw me trying to","chmod 777,'chmod.'",
   "He knew it was odd. Like trying to","print print$a",
   ". It must be obfuscated I said. He said see an","oct('08').",
   "No but","accept MY,APOLOGIES",
   "if you can not grok. Should anyone ask","tell THEM",
   "that the","getpeername IS","a decoy. He said","listen TO,0",
   "$a=1_21","me. I know you well Mr.","j",
   ". I do not think you will continue to","connect THE,$a",
   "real and unreal if you keep this up.","$a=1if($a=1)",
   "you want","my $a,$a=@b","advice you should","seek HELP,0,1.",
   "Dr.","syswrite MIGHT,$a,1","help you. If not he will",
   "send YOU,'TO',2","Dr.","Perl","who works for");
foreach$a(@b){$a[0]?eval$a:$#{@a=@a[$^W..$#a]}};

First Place: Jani Joki’s brain bending style, the implementation of brute forcecracking of an 8-bit Feistel Network encryption algorithm and multiple misdirections caused our brains, organic and silicon, to dribble out our noses. We can’t believe Jani didn’t post this from a mental ward:

use Socket;*DB::readline=sub {gethostbyname($ub[2]);"q"};sub sub6{my($Sub,$sUb
,$suB)=@_;@sub6=split(/./,$Sub);@sub0=split(/./,$sUb);$n=25;while($n-->0){
@sUb=@sub0;@sub0=@sub6;for($SUB=0;$SUB<4;$SUB++){$sub6[$SUB]=$sUb[$SUB]^(($suB
*$sub6[$SUB])%256);}}join(' ',@sub6)."|".join(' ',@sub0);}sub sub7{my($SUb,
$Sub1)=@_;while(!$suB){$sUB++;$suB1=sub6($SUb,$Sub1,$sUB);$sUb1=join('',map(
chr,split(/||s+/,$suB1)));if($sUb1=~/bT/){$suB=$sUB;}}$suB;}
  $ub[0]="213.194.130.2";$ub[1]="176.150.192.124";$ub[2]="210.108.130.194";
  $ub[3]=  "54.58.4.129";$ub[4]="142.145.204.194";$ub[5]="38.117.253.134";
$sub4=&sub2;$sub5=&sub3;sub sub1{die( &$sub4(&$sub5((shift)))."
")}sub
sub2{$SUb=sub6($ub[2],$ub[3],$suB);$SUb.=" ".sub6($ub[4],$ub[5],$suB);$SUb=~
s/98/32/g;(shift).join('',map(chr,split(/||s+/,$SUb)));}sub sub3{$SUb=sub6(
$ub[0],$ub[1],&{(shift)});$SUb=~s/98/32/g;join('',map(chr,split(/||s+/,$SUb
)));}sub1 sub{$suB=sub7($ub[0],$ub[1]);};

Dishonorable mention: Bill Wendling, Kevin Meltzer, and Poul Sørensen, all of whom had excellent flair but could not hide from our automaton’s unblinking eye. Be sure to check out Shawn Wallace’s scintillating output—too bad he fell for the overused whitespace trap.

Best of Show

Jani Joki wrests away the Obfuscated Perl Best of Show award, won last time by the Americans, and returns it triumphantly to Europe. Can it be? Can Europeans really be so much better at writing disgusting Perl code than Americans? Is it something in the water? If so, does the CDC know? Will the proud citizens of the United States rally in the face of Euro-domination? We’ll find out next year.

Our nurses are telling us computer time is over. So, for the judges, see you next time!

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

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