Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Pulling JAPH out of nowhere...

by kejohm (Hermit)
on Jun 04, 2011 at 13:13 UTC ( #908124=obfuscated: print w/ replies, xml ) Need Help??

Hi monks,

This is my first JAPH. Inspired by perlpacktut.

print pack('C',unpack('%c*',unpack('W',pack('J')))+unpack('%c*',unpack +('a',pack( 'A')))-unpack('%B*',unpack('U',pack('A')))+unpack('%b*',unpack('a',pac +k('A')))), pack('C',unpack('%Z*',unpack('W',pack('A')))+unpack('%W*',unpack('n',p +ack('V'))) -unpack('%C*',unpack('a',pack('A')))),pack('C',unpack('%a*',unpack('C' +,pack('A') ))+unpack('%U*',unpack('b',pack('C')))-unpack('%C*',unpack('a',pack('A +')))- unpack('%B*',unpack('B',pack('L')))),pack('C',unpack('%U*',unpack('c', +pack('A')) )+unpack('%U*',unpack('b',pack('Z')))-unpack('%Z*',unpack('a',pack('A' +)))-unpack ('%b*',unpack('Z',pack('A')))),pack('C',unpack('%U*',unpack('a',pack(' +A')))), pack('C',unpack('%a*',unpack('H',pack('A')))+unpack('%a*',unpack('J',p +ack('j'))) -unpack('%b*',unpack('a',pack('A')))),pack('C',unpack('%C*',unpack('U' +,pack('A') ))+unpack('%B*',unpack('W',pack('A')))+unpack('%b*',unpack('H',pack('h +')))),pack ('C',unpack('%W*',unpack('c',pack('A')))+unpack('%b*',unpack('W',pack( +'A')))+ unpack('%B*',unpack('H',pack('A')))),pack('C',unpack('%U*',unpack('C', +pack('A')) )+unpack('%C*',unpack('I',pack('J')))-unpack('%c*',unpack('Z',pack('A' +)))-unpack ('%b*',unpack('a',pack('A')))),pack('C',unpack('%C*',unpack('C',pack(' +A')))+ unpack('%b*',unpack('H',pack('A')))),pack('C',unpack('%Z*',unpack('C', +pack('A')) )),pack('C',unpack('%C*',unpack('W',pack('A')))+unpack('%b*',unpack('W +',pack('A' )))+unpack('%b*',unpack('H',pack('A')))+unpack('%b*',unpack('J',pack(' +J')))+ unpack('%b*',unpack('Z',pack('A')))),pack('C',unpack('%C*',unpack('Z', +pack('A')) )),pack('C',unpack('%W*',unpack('b',pack('S')))+unpack('%Z*',unpack('Z +',pack('A' )))),pack('C',unpack('%C*',unpack('U',pack('A')))),pack('C',unpack('%W +*',unpack( 'c',pack('A')))+unpack('%B*',unpack('c',pack('A')))+unpack('%b*',unpac +k('H',pack ('A')))+unpack('%B*',unpack('b',pack('A')))+unpack('%b*',unpack('Z',pa +ck('A')))) ,pack('C',unpack('%c*',unpack('c',pack('A')))+unpack('%b*',unpack('c', +pack('A')) )),pack('C',unpack('%C*',unpack('a',pack('A')))),pack('C',unpack('%U*' +,unpack( 'C',pack('A')))+unpack('%B*',unpack('H',pack('A')))),pack('C',unpack(' +%Z*', unpack('H',pack('A')))+unpack('%Z*',unpack('i',pack('N')))-unpack('%b* +',unpack( 'Z',pack('A')))),pack('C',unpack('%C*',unpack('H',pack('A')))+unpack(' +%c*', unpack('C',pack('v')))+unpack('%b*',unpack('Z',pack('A')))),pack('C',u +npack( '%W*',unpack('c',pack('A')))+unpack('%b*',unpack('c',pack('A')))-unpac +k('%B*', unpack('a',pack('A')))),pack('C',unpack('%A*',unpack('C',pack('A')))), +pack('C', unpack('%c*',unpack('C',pack('A')))+unpack('%U*',unpack('c',pack('N')) +)-unpack( '%A*',unpack('Z',pack('A')))-unpack('%b*',unpack('H',pack('A')))),pack +('C', unpack('%U*',unpack('B',pack('i')))-unpack('%b*',unpack('H',pack('A')) +)-unpack( '%b*',unpack('a',pack('A'))));

Comment on Pulling JAPH out of nowhere...
Download Code
Replies are listed 'Best First'.
Re: Pulling JAPH out of nowhere...
by Grimy (Pilgrim) on Jun 04, 2011 at 20:48 UTC
    Hi,

    That's a nice one. I like the fact that it uses pretty much all existing pattern elements. It should definitely be added to perlpacktut, its examples aren't unclear enough.

    Unless you're making a motto to using nothing else than packs and unpacks, you could replace the 25 outermost packs by map pack.

      All pattern elements? Does it use all the crazy and redundant ones as well? My favourites are

      $ perl -we 'print unpack "x*(a*\@0X)*(a*@)*", "hello\n";' o lo llo ello hello ello llo lo o $ perl -we 'print unpack(pack("(a*)*", unpack("(a*@[])*", "x./a")), " +J ust anotherr perl hacker\n");' Just another perl hacker $

      Update: see also Just another unpack hacker.

      I was considering using map(), but I figured I should only use pack() and unpack() (I could also have used chr() in place of pack('C',...)).

      There were certain templates that I ignored for one reason or another. The 'P' and 'p' templates would probably only produce random data, and the 'w' template is only available on newer versions of Perl. Also, the 'q' and 'Q' only work on 64-bit Perl, and the 'X' template didn't really seem to make much sense in this context.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2015-09-01 00:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (366 votes), past polls