Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Obfuscated code

( #1597=superdoc: print w/ replies, xml ) Need Help??

Got some code which would take a Perl grand master to understand without running it? Post it in this section so we can stare at it in awe.

Word of warning, though: Don't be too cocky with your post — almost inevitably someone will post a reply that does the exact same thing in even fewer characters!

New Less than Readable Code
JAPH does the splits
1 direct reply — Read more / Contribute
by Schmunzie
on Apr 12, 2015 at 19:14
    My first JAPH for years and years. I'm not sure if this is platform-independent. I hope it is.
    @z=split(//,BGu6pCozwKzR);@y=qw(zlz hqa zuo reg rqz fpx 72 26 25 53 25 + 06);while(@z){@a=split(shift@z,crypt(shift@y,pop@y));@g=split(pop@z, +$a[1]);print $g[0]}
This One's a Sieve
2 direct replies — Read more / Contribute
by Schmunzie
on Mar 31, 2015 at 11:17
    hdb recently pointed out that I had misremembered how the Sieve of Eratosthenes works so now I'm having another go. Not all that obfu'd but moderately golfed.

    $m=250;for(2..$m){for($a=$_*2;$a<=$m;$a+=$_){$c[$a]++}print"$_,"x!$c[$_]}

What Perl Will Tell
No replies — Read more | Post response
by martin
on Mar 20, 2015 at 00:05
    This one may be somewhat system-dependent but worked with quite different flavours of Perl. I expect it will be difficult to predict without actually using a perl binary. Have fun!
    eval'[]->Jk',$^X=~m;(?:.*[\\/])?([^\W\d]+);;$==ord('?'^':'),$,=q** ,*_=[map+chr,$[..$=<<$=],*_={map{;$_,++$=}grep/(?=\W)[$"-~]/,@_},* _=sub{map{join$,,@_[@_{split$,,$_}]}+$,."->]'","!?;'(&}","(! .\\}" },*_=[_(split$,,$@),"\u$1"],*_=\"@_[$[,!!!$[,-!$[,$#_^!$[],",print
Are old obfus gone forever?
5 direct replies — Read more / Contribute
by Schmunzie
on Mar 19, 2015 at 20:39
    Years ago, with a previous account (no idea of my name then) I posted an obfu of which I was immensely proud. The code was in the shape of an ornate grand-father clock, complete with pendulum and the output was the current time (to the nearest 12 mins) on an ASCII analogue clock face.

    I would love to see it again.

Not a Sieve
2 direct replies — Read more / Contribute
by Schmunzie
on Mar 16, 2015 at 06:51
    $i++;while(@p<50){$i++;&d;print"$i,"x!$x}sub d{for(@p){if($x=(!($i%$_))){return}}push@p,$i}
An obfu for Pi Day
No replies — Read more | Post response
by Schmunzie
on Mar 14, 2015 at 09:24
    $e=$k=$f=$a=$m=$n=1;@y=split//,"mpqeyn";$y=$p=$a+$m+$n;push@mn,pop@y;u +nshift@mn,shift@y;while($#p<14){$a++;@b=@p;&d}while($f>2**-$p[$#p]){$ +i+=2;$r=$i%4;$f=4/($i*($i+1)*($i+2));$p+=$f*($r-1);if($i/2<$p[$p[4]]) +{eval"\$$mn[$r/2]+=\$$mn[!$r]";$y=$y/2+1/$y;eval"\$q=\$$mn[$r/2]/\$$m +n[!$r]";$k*=($i/2);$e+=1/$k}}for$o(@y){print"<br>$$o"}sub d{while(@b) +{$x=!($a%shift@b);if($x){return}}push@p,$a;print"$a,"}
First Japh
2 direct replies — Read more / Contribute
by Discipulus
on Feb 06, 2015 at 07:15
    Not sure if can be considered an obfu..
    unx#perl -e '@_="Js nte elHce rka rPrhoAtu"=~/./g;for$}(1..$#_+1){whil +e(<$0 >){(s|e|($}%2?shift@_:pop@_)|e);print}}' win>perl -e "@_='Js nte elHce rka rPrhoAtu'=~/./g;for$}(1..$#_+1){whil +e(<$0 >){(s|e|($}%2?shift@_:pop@_)|e);print}}"
    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Late PM, 12/24/2014 & all year long
2 direct replies — Read more / Contribute
by ww
on Dec 24, 2014 at 23:00
    perl -e "srand 42; print sort {4-rand 9} split //, 'ts aroMrhirsae C tll!!ym';"

    Adapted from Re^2: Slightly Srandom JAPH; Update: now known to be highly OS and version specific, but "Season's Greetings" anyway!
    *1 : Alt date format: 20141224. This node, however, is known to be ISO 2000 non-compliant.
    *3Notes placed in sig & then reordered for comppliance with obfuscation.
    *2 : Original OS/vers.: AS 5.018 & Win7.

Code golfing site - SHORTEN
1 direct reply — Read more / Contribute
by kokosek
on Nov 30, 2014 at 21:09

    Hello. I'm the admin of http://spoj.com/SHORTEN. A site, in which you can submit your Perl programs and they will be compiled and run with problem's data.

    I have a user there who is especially good in Perl and he has the best score (= shortest programs) in most problems. So I was thinking that perhaps some of you would like to give it a try and challenge him. I'm wondering whether anybody can beat him in any task.

    Here's a ranking for Perl (as you can also submit on SHORTEN programs in other languages):
    http://sphere.pl/~kokosek/langrank/perl.php
    As you can see, his score is 9.93/10.

    To encourage you, printing n-th Fibonacci number takes in Perl only 43 chars (assuming t tests) - it's FIBON problem on SHORTEN if you wondered.

I love eval
No replies — Read more | Post response
by Anonymous Monk
on Nov 27, 2014 at 12:23
    $_='($.=".-3-01/1-5+5*7)7)G*E,C.A0?3;77;3?0A-D+F)8")=~s#.#(($a^=1)?$": +"X" )x(ord($&)-40)#eg;($l=$.)=~s#X#(split//,"ILOVEYOU")[$p++%8]#eg;;;$.=~s +#X# (split//,"\$_=\47$_\47;s/\134s//g;eval")[$q++]#eg;{print("\ec".join$/, +unp ack"(A32)*",(($z^=1)?$.:$l))&sleep(1)&redo}';s/\s//g;eval #TSR +'14

    shape stolen from here


Set the new obfuscation standard
Title:
code@?#!:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":


  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (11)
    As of 2015-04-28 10:55 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Who makes your decisions?







      Results (519 votes), past polls