Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

My very own little JAPH

by cfreak (Chaplain)
on Jul 16, 2002 at 19:25 UTC ( #182209=obfuscated: print w/replies, xml ) Need Help??

Be nice this is my first one, (boss is gone today! :) )

$s1='!,@,#,$,%,;,&,+,.,:,>,7,?,<';$s2='@,#,B,D,E,0,F,C,A,6,4,<,5,9'; sub mrg{return @_;}@a=split /,/,$s1;@c=split /,/,$s2;foreach(@a){$n= ord($_);@d=mrg(@d,chr($n+ord($c[$i])));$i++;}print@d[4,13,11,12],' ' ,@d[0,7,8,12,3,2,10],' ',@d[9,2,10,6],' ',@d[3,0,1,5,2,10],"\n";

Suggestions are very welcome!

UPDATE
After reading the BUU's suggestions I made some modifications: here's try #2 :)

$;= '!,@,#,$,%,;,&,+,.,:,>,7,?,<,9,5,<,4,6,A,' .'C,F,0,E,D,B,#,@';$|= 1;sub mg{return@_}eval{ @_=split /,/,$;;@ARGV=reverse(splice(@_,14,27) );$;=();map{@{$;}=mg(@{$;}, chr(ord($_) + ord( $ARGV[$i])));$i=$i+scalar(@_)-13;}@_;@ARGV=mg( @_,@ARGV);print@{$;}[4],@{$;}[13],@{$;}[11],@{ $;}[12],' ',@{$;}[0],@{$;}[7],@{$;}[8],@{$;} [ 12],@{$;}[3],@{$;}[2],@{$;}[10],' ',@{$;}[9,2, 10,6],' ',@{$;}[3,0,1,5,2,10],"\n";}##########

Lobster Aliens Are attacking the world!

Replies are listed 'Best First'.
Re: My very own little JAPH
by BUU (Prior) on Jul 16, 2002 at 23:05 UTC
    Suggestion 1: DEFAULT VARIABLE. Always, always, always use $_ to avoid having to explicitly feed args.

    Suggestion 2: Regexen: abuse the hell out of 'alternate begin/end chars' (m;foo;).

    Suggestion 3: Quote operators. Abuse the 'alternate' quote operators, such as qq, q, and qx, along with their alternate end/begin chars.

    Suggestion 4: Use map, not variables and fors, and pipe yer list from one map to another.

    Suggestion 5: (Ab)use whitespace and 'end of lines' (aka semicolons) and put them in semi random spots. So instead of my $faz='foo';print $foo, do something like
    my $faz = 'foo' ;print$foo;
    Suggestion 6: Comments are also fun, but make them misleading. i.e. $_=$; #assign my dollar sign to $_, as this can help mess people up.

    Suggestion 6: builtin variables. Learn to love them always. $;='fooz' is much more fun then $s1='fooz'.


    Over all, you can go two ways. First (the bestest) is to be misleading. Evals + alternate quoting operators are fun to abuse here. Secondly (boring) is to just jumble as many maps and special vars + random punctuation together as you can, while the first is probably the best, the second can be almost impossible to figure out (without lots of effort), and is probably easier.
Re: My very own little JAPH
by cecil36 (Pilgrim) on Jul 17, 2002 at 19:41 UTC
    I'ts worth an upvote or two for effort.
Re: My very own little JAPH
by BUU (Prior) on Jul 20, 2002 at 20:27 UTC
    ++ on the second try, now i can officially say, "i have no bloody clue what its doing", which is always the point of a true obfuscation.

    One final thought on seeing the second try, is that you might want to try playing around with obscuring functions, i.e. instead of doing "print $foo", you could do something like "@_=q:print:;push @_,$foo; eval pop;pop;". While thats not an incredibly good example, im sure you could do better.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://182209]
Approved by giulienk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2020-02-19 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (80 votes). Check out past polls.

    Notices?