Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Really bored at work JAPH

by karl_heinrich (Acolyte)
on Oct 31, 2002 at 06:05 UTC ( [id://209351]=obfuscated: print w/replies, xml ) Need Help??

This is my first one, comments/suggestions/gripes appreciated.
#!/usr/bin/perl -w use strict;my@AoA;my($x,$y);my$w =20;my$h=20;for$x(0..$w){for$y## (0..$h){$AoA[$x][$y]=sqrt(($x-## 0.5*$w)**2+($y-0.5*$h)**2)/10+## 0.01;}}for$x(0..$w){for$y(0..$h) {if($AoA[$x][$y]>=0&&$AoA[$x]### [$y]<=0.25){print'j';}elsif($AoA [$x][$y]>=0.25&&$AoA[$x][$y]<=## 0.5){print'a';}elsif($AoA[$x]### [$y]>=0.5 &&$AoA[$x][$y]<=0.75)# {print'p';}elsif($AoA[$x][$y]### >=0.75&&$AoA[$x][$y]<=1){print## 'h';}else{print' ';}}print"\n";}
Karl

Replies are listed 'Best First'.
Re: Really bored at work JAPH
by rdfield (Priest) on Oct 31, 2002 at 12:28 UTC
    OK for a first post...but it's a bit obvious - print'j';,print'a'; - isn't it?

    It might be worth having a look through some of the previous obfus to get some inspiration regarding hiding the obvious: eg s///ee, y, odd looking quoting etc.

    rdfield

Re: Really bored at work JAPH
by karl_heinrich (Acolyte) on Oct 31, 2002 at 20:52 UTC
    Ok, here's an improvement on my previous post:
    #!/usr/bin/perl -w use strict; my@AoA;my@tmp;my($x,$y);my$w=20;my$h=20;my( $tmp,$tmp2,$tmp3);for$x(0..$w){for$y(0..$h) {$AoA[$x][$y]=sqrt(($x-0.5*$w)**2+($y-0.5*$ h)**2)/10;}}foreach(0 .. 3){if(2*$_+1==1){$ tmp2++;}elsif(2*$_+1==3){$tmp+=2*$_+1;}else {$tmp*=2*$_+1;}}$tmp+=$tmp2;$tmp[0]=$tmp;## $tmp2=1;$tmp3=2;foreach(1..3){$tmp2*=$_;}## foreach(1..2){$tmp3**=2;}$tmp=$tmp2*$tmp3+1 ;$tmp[1]=$tmp;$tmp=13;$tmp+=(81**(1/4))**2* ('1'.'1');$tmp[2]=$tmp;$tmp=1;foreach(1..3) {if(2*$_!=6){$tmp *= 2*$_;}else{$tmp*=((4*$ _)+1);}}$tmp[3]=$tmp;for$x(0..$w){for$y(0.. $h){if($AoA[$x][$y]>=0&&$AoA[$x][$y]<=0.25) {print chr($tmp[0]);}elsif($AoA[$x][$y]>=## 0.25&&$AoA[$x][$y]<=0.5){print chr($tmp[1]) ;}elsif($AoA[$x][$y]>=0.5&&$AoA[$x][$y]<=## 0.75){print chr($tmp[2]);}elsif($AoA[$x][$y ]>=0.75&&$AoA[$x][$y]<=1){print chr($tmp[3] );}else{print' ';}}print"\n";}#############
    Lemme know what you think. Thanks.

      *sigh*, hopefully this will be constructive as well...

      Essentially the problem i see is that you are making one of the first-poster mistakes while using a useful/interesting technique. This is a problem because of the axiom "whitespace does not an obfu make". If we apply white space to your code it becomes fairly obvious what you're doing.

      The algorithm you use is a good solid place to start, and i think it's beauty. Unfortunately it's a one-trick pony. No offense, but your rehash isn't that obfuscated either since all that has happened is more code made it's way into the process. More code doesn't mean harder to read, just more to read.

      If you want to obfuscate the code more you can't tell the audience where the data is originating and/or how it's set up. In the case of this piece you tell people you're using an array of arrays and you explicitly use $x and $y in your code, which is a dead mathematical giveaway.

      So, you've got a good start: an original idea (to you at least). From there you've implemented it (an important step because it proves it can be done; i've not submitted many an obfu because i couldn't implement it to begin with!). The next step is to cull the code for redundancies and easy to read bits. As always, using built-ins and interesting names for variables is usually a plus. As an example, one direction you could have gone for a twist of this obfuscation is on my scratchpad...

      jynx

Re: Really bored at work JAPH
by mkahn (Beadle) on Nov 05, 2002 at 00:40 UTC
    Cool! A bullseye!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://209351]
Approved by blakem
Front-paged by jarich
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-03-28 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found