P is for Practical PerlMonks

### PM Obfu

by Felonious (Chaplain)
 on Oct 12, 2002 at 07:44 UTC ( #204745=obfuscated: print w/ replies, xml ) Need Help??

Update: Fixed scrolling issue in text mode console
```#!/usr/bin/perl
\$m=q\\$g=59;\$s=23;@v=(\$",\$",'.',';','x','X','M');\$t=[map{[(s
plit('',\$_))[0..\$g]]}reverse+split(\$/,\$m)];sub'i{(\$b)=@_;\$b
->[0]=[(0            )x(\$g+1)    ];for(@{\$b->[    0]}){\$_=\$
#v*(int(r             and(7))     <3);}for(1.     .(\$s)){@{
\$b}[\$_]=[    (0)x(    \$g+1)];      }}sub'p{(      \$b)=@_;sy
stem(\$^O=    ~/MSW    in32/?'       cls':'c       lear');\$s
tr='';for             \$r(reve        rse(0        ..\$s)){fo
r\$c(0..\$g           ){\$str.=(    \$t   ->[   \$r    ][\$c]eq\$"
?\$":@v[in    t\$b->[\$r][\$c]]);    }\$s       tr.    =\$/;}prin
t\$str;}su    b'f{(\$x)=@_;\$b=[    ];i(\$b);for\$r    (1..(\$s-1
)){for\$c(    1..(\$g-1)){if(in    t(rand(2))){\$    v=0;for\$r
i(-1..1){    for\$ci(-1..1){\$v    +=\$x->[\$r+\$ri    ][\$c+\$ci]
;}}\$b->[\$r][\$c]=\$v/9;}else{\$b->[\$r][\$c]=\$x->[\$r-1][\$c];}}}r
eturn \$b;}\$z=[];i(\$z);p(\$z);while(1){\$z=f(\$z);p(\$z);}\;\$m.=
"\$/\$/\$/\$/\$/\$/1;\$/\$/\$/\$/\$/\$/\$/";;s//\$m/;s/\$"//g;s|\$/||g;eval

[TINPC@perlcabal.com shh]\$ su real

Comment on PM Obfu
Replies are listed 'Best First'.
Re: PM Obfu
by Len (Friar) on Oct 12, 2002 at 17:41 UTC
Brilliant idea Felonious !

I only miss the sound of sizzling and crackling burning wood.

Oh wait..

perl pm_obfu.pl | tee /dev/audio

that's all I need for tonight :)

Felonious++

Re: PM Obfu
by husoft (Monk) on Oct 12, 2002 at 18:36 UTC
Can you explain a few things I don't understand?

- First thing I don't understand is this way of making
subs (sub'i, sub'p, sub'f) what's the main difference
from the sub i{..}.

- Second, in this line : \;\$m.="\$/\$/\$/\$/\$/\$/1; I don't
really get what you are doing there.

- Third, \$/\$/\$/\$/\$/\$/\$/";; why ;;?

```#!/usr/bin/perl

\$m=q\\$g=59;
\$s=23;

@v=(\$",\$",'.',';','x','X','M');
\$t=[map{[(split('',\$_))[0..\$g]]}reverse+split(\$/,\$m)];

sub'i{
(\$b)=@_;
\$b->[0]=[(0)x(\$g+1)];

for(@{\$b->[0]}){
\$_=\$#v*(int(rand(7))<3);
}

for(1..(\$s)){
@{\$b}[\$_]=[(0)x(\$g+1)];
}
}
sub'p{
(\$b)=@_;
system(\$^O=~/MSWin32/ ? 'cls': 'clear');

\$str='';
for \$r(reverse(0..\$s)){
for \$c(0..\$g){
\$str.=(\$t->[\$r][\$c]eq\$"?\$":@v[int \$b->[\$r][\$c]]);
}\$str.=\$/;
}
print \$str;
}

sub'f{
(\$x)=@_;\$b=[];i(\$b);

for \$r(1..(\$s-1)){
for\$c(1..(\$g-1)){if(int(rand(2))){
\$v=0;for\$ri(-1..1){
for\$ci(-1..1){
\$v+=\$x->[\$r+\$ri][\$c+\$ci];
}
}

\$b->[\$r][\$c]=\$v/9;
}else{

\$b->[\$r][\$c]=\$x->[\$r-1][\$c];}}}
return \$b;

}

\$z=[];
i(\$z);
p(\$z);
while(1){
\$z=f(\$z);
p(\$z);
}

\;\$m.="\$/\$/\$/\$/\$/\$/1;
\$/\$/\$/\$/\$/\$/\$/";;
s//\$m/;
s/\$"//g;
s|\$/||g;
eval
1) sub'i{} means the same as sub main::i {}, in this case it's used to get rid of the space (important because spaces are used as a mask).
2 and 3) these serve as filler to make the code rectangular and for tweaking the position of the mask over the output.

[TINPC@perlcabal.com shh]\$ su real
Re: PM Obfu
by JaWi (Hermit) on Oct 12, 2002 at 09:01 UTC
I've finally got a worthy replacement for my fireplace video... Very nice job!

-- JaWi

"A chicken is an egg's way of producing more eggs."

Re: PM Obfu
by kelan (Deacon) on Oct 12, 2002 at 08:28 UTC
Re: PM Obfu
by jjdraco (Scribe) on Oct 12, 2002 at 08:36 UTC

jjdraco
learning Perl one statement at a time.
Re: PM Obfu
by husoft (Monk) on Oct 12, 2002 at 16:06 UTC
incredible obfu, nice work!
Re: PM Obfu
by Kage (Scribe) on Oct 12, 2002 at 22:56 UTC
Wow.. Very nice.. My server burped and farted a few times because of it, but it runs. Now do one that says KAGE and you will be my God. :)
PuuPuuPlatter
Re: PM Obfu
by Anonymous Monk on Oct 13, 2002 at 07:39 UTC
Errr... wow. That is the most impressive obfuscated animation I've seen in some time...
*bows*
Re: PM Obfu
by tbone1 (Monsignor) on Oct 15, 2002 at 13:03 UTC
Dayumn!

You know, figuring this out is just going to wreck our group's productivity today. But at least it's a more fun (and logical) wreckage than having marketing involved!

--
tbone1
As God is my witness, I thought turkeys could fly.

Create A New User
Node Status?
node history
Node Type: obfuscated [id://204745]
Approved by kelan
Front-paged by kelan
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2015-11-30 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?