samjh
September 20th, 2007, 11:02 AM
I've just come across www.perlmoks.org. It looks like a Perl programming website, boasting many weird uses of Perl.
Since I'm not a Perl programmer, curiosity got the better of me, and upon a little shallow browsing of the site's contents, I discovered this obfuscated Perl code which happens to be the most creative use of obfuscated code I've ever seen!
Original here: http://www.perlmonks.org/?node=Obfuscated%20Code
my $f="^("
;my $r = '"';my$c
= 1; my $i; my $t;sub
llama{my $n=shift;my
$r=""; for
(1..11){$r
.=($n>=(2
**(11-$_))
)?1:0;if(
rindex($r,
"1")==$_-1
){$n-=(2**(
11-$_));}} return $r;}$_ = "0";$_.=llama(1855) ; $_ .=llama(
188);$_.=llama(935); my @i= split(//,$_);foreach(@i){#;+++''
$_+=2;$f.='.'x$_.')('; $r.='$'.$c++.' ';}$r .= '"';#';+++;++'
$f.=')';my $string = "";foreach(<DATA>){$string.=$_;}#'+#++;:
$string =~ s/[ \n]//g;my@g=unpack("C*",$string);#;';:;##+'#
my $st="";for(1..44){$st .= (($t=(($i=shift(@g))==#';###':
38)?$i+shift(@g):$i-shift(@g))<=9)?#,.+'';'';';+'''++@#,
"0".$t:$t;}$_=$st ."4";#++'##+;',::',;;+#;+##,;;@#@#+,
/$f/;###';##';;;;++#+@++@#+#@+'',:'';'''+##+@;#:+@#:;
my $s = eval $r;#`'+@@@@##@@@+###@#;,''#@@+@''++#+',
my @p = split(/ /, $s);#@@@@+#@'@'+##+##@+#@++#@,`
print pack("C*",@p). "\n";###@#@+#;@##+@######'`
#@@#'';:+'''+#++` '@@@#@#@@@###@@####@#+',.
#@@+;##;'+;+#` ,:+####@@@+#@#+#@#+@#
#@@#++#;+## ..+#+''#'@@@@#;+@#
#@@##++''' ` ,.` #@@@@#;#;.
__DATA__ #@@@@@@#+'
&$.#&! :+.#{<?"&
!.$.# .#:*.$O&%$
.#O$< $.%&!.%&;
.#_" %$. #&!
:,O& O/ }-
.$. #< ..
$} *< '+
'&; &= .$
&! %$ .#Now... just what in the universe full of electrons does that thing do?!
:popcorn:
Since I'm not a Perl programmer, curiosity got the better of me, and upon a little shallow browsing of the site's contents, I discovered this obfuscated Perl code which happens to be the most creative use of obfuscated code I've ever seen!
Original here: http://www.perlmonks.org/?node=Obfuscated%20Code
my $f="^("
;my $r = '"';my$c
= 1; my $i; my $t;sub
llama{my $n=shift;my
$r=""; for
(1..11){$r
.=($n>=(2
**(11-$_))
)?1:0;if(
rindex($r,
"1")==$_-1
){$n-=(2**(
11-$_));}} return $r;}$_ = "0";$_.=llama(1855) ; $_ .=llama(
188);$_.=llama(935); my @i= split(//,$_);foreach(@i){#;+++''
$_+=2;$f.='.'x$_.')('; $r.='$'.$c++.' ';}$r .= '"';#';+++;++'
$f.=')';my $string = "";foreach(<DATA>){$string.=$_;}#'+#++;:
$string =~ s/[ \n]//g;my@g=unpack("C*",$string);#;';:;##+'#
my $st="";for(1..44){$st .= (($t=(($i=shift(@g))==#';###':
38)?$i+shift(@g):$i-shift(@g))<=9)?#,.+'';'';';+'''++@#,
"0".$t:$t;}$_=$st ."4";#++'##+;',::',;;+#;+##,;;@#@#+,
/$f/;###';##';;;;++#+@++@#+#@+'',:'';'''+##+@;#:+@#:;
my $s = eval $r;#`'+@@@@##@@@+###@#;,''#@@+@''++#+',
my @p = split(/ /, $s);#@@@@+#@'@'+##+##@+#@++#@,`
print pack("C*",@p). "\n";###@#@+#;@##+@######'`
#@@#'';:+'''+#++` '@@@#@#@@@###@@####@#+',.
#@@+;##;'+;+#` ,:+####@@@+#@#+#@#+@#
#@@#++#;+## ..+#+''#'@@@@#;+@#
#@@##++''' ` ,.` #@@@@#;#;.
__DATA__ #@@@@@@#+'
&$.#&! :+.#{<?"&
!.$.# .#:*.$O&%$
.#O$< $.%&!.%&;
.#_" %$. #&!
:,O& O/ }-
.$. #< ..
$} *< '+
'&; &= .$
&! %$ .#Now... just what in the universe full of electrons does that thing do?!
:popcorn: