Hi all,

this is my very first post here. I'd like to talk about my latest japh. My previous attempts had concentrated on either code or data obfuscation by means of tons of stuff like q* constructs with strange delimiters, eval(), and so on.

For this particular one instead I had a precise algorithm in mind. Eventually it turned out to be more of a golfing exercise than an obfuscation one. All in all there's no obfuscation at all and not much data obfuscation either, in the sense that it is clear to see *where* it is stored. Still IMHO it's not so easy to understand *what* the algorithm does and *why* it works. Here it is:

{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB=' .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_, 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
Note that it's not a japh in the strictest sense, i.e. it doesn't simply print() "Just another Perl hacker,\n". Also, the effect it achieves is manifest under xterms and at *DOS prompt, whereas Linux console, even with $|==1 is too fast for it. A variant in which I slow it down by making it do a "few" unnecessary operations is
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB=' .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_, 256),-9999..249,7);s/[^\w,]/ /g;$\=/^J/?$/:"\r";print,redo}
Despite what some people think about this kind of exercises, it turned out to be very instructive.

For example the first versions of this japh were so verbose that I didn't hope it would have been possible to shrink it to fit in .sig's standards. A big improvement was obtained when I realized that I didn't need to work with strings of "\0" and "\01" as I had initially assumed, but that any two chars would do instead. This is obvious if you think about the possible outcome of an expression of the kind a*b*c where * is a binary operation "of the kind of XOR" and a,b, and c can take two values only. But it was not so obvious until I stopped to think about it...


In reply to My 1st post (japh) by blazar

Title:
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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.