Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Encoding wonders

by srawls (Friar)
on Jun 12, 2001 at 01:25 UTC ( #87656=obfuscated: print w/replies, xml ) Need Help??

Look carefully at the first line. Now try to figure out how this JAPH is encoded; when you do you'll be scared : ) And for those who can't find out, just click the readmore tag.
die unless print keys %j and open uc sqrt hex chr lstat; @_[0..100]=grep{!/[qyixd;%]/}split//,~~<0>;$\=$/;print substr join( $&,map{$$_[$[]}sort{z($$a[1])<=>z($$b[1])}map{[$_[$_],$_]}0..46),23; sub z {@h[18,28,6,12,13,20,3,23,33,35,0,10,1,9,5,32,4,8,39,45,29,14,15 +,40]= (1+\\///\\\//..$=);$h[pop];}

The 15 year old, freshman programmer,
Stephen Rawls

Well, the first line opens the script, but it also does something else. Look at each of the functions on the first line. Notice that they have the individual characters of "just another perl hacker" spread among them. This is how I generate the JAPH. So the thing that will blow you away is that the very line used to open the encoded message is infact the encoded message. It took me a many searches of man perlfunc to find functions with the right letters.

Replies are listed 'Best First'.
Re: Encoding wonders
by earthboundmisfit (Chaplain) on Jun 12, 2001 at 17:38 UTC
    hcaker (ach-cakah): n. A pastry baked by persons whose names begin with the letter 'h'

    Misspellers of the world, untie!! ;-)

      Sorry for the wisecrack, but this script really does print out 'hcaker' for me.
Re: Encoding wonders
by virtualsue (Vicar) on Jun 13, 2001 at 01:16 UTC
    For whom does this JAPH work, and why? It outputs nothing but a newline with perl 5.6 & 5.005_03 on Sun Solaris 2.6, 2.7 & 8.
    Given that you've indicated in a previous [id://85311\node] (a followup to another JAPH/obfu that failed in the same way here) that this is more or less your platform, that's a little puzzling.
      Humm, it works on my Sun Solaris 5.7. Make sure that the first line is not blank, this should appear before any new lines:
      die unless print keys %j and open uc sqrt hex chr lstat;
      If that doesn't work, I'll try to see what else might be wrong.

      Update: Oh yeah, Perl version 5.005

      The 15 year old, freshman programmer,
      Stephen Rawls

        Works for me (Sun Solaris 5.7).
        #First line, does as you said; #uc sqrt hex chr lstat evals to 0, and open w/ string #appends $ in front, so it opens $0, aka, yourself die unless print keys %j and open uc sqrt hex chr lstat; #~~<0>; 0 is the filehandle, so it reads in one line #...the two negations(~~) cancel each other out, by the way #You assign to @_, ignoring q, y, i, x, d, ;, and % #(since, I presume, they aren't in the string you print out) @_[0..100] = grep{!/[qyixd;%]/}split//,~~<0>; #Simple enough, set output sep., to rec. sep, i.e., \n $\=$/; #Here's where the magic takes place. print substr join( #First, you map the @_ array that you assigned to for #values 0..46; you sort them w/ z sub, dereferencing them #And then you map them, again dereferencing $&, map{$$_[$[]} sort{z($$a[1])<=>z($$b[1])} map{[$_[$_],$_]}0..46),23; #This function (taking your ref. to ref. to match, divided # by ref. to ref. to ref. to match plus 1..$=, i.e., 1..60 #You've arranged it so as to pop the values you need to to #get the correct result; It's difficult to figure out at #first glance, however, so I'll leave it for someone else #to inform us of. sub z {@h[18,28,6,12,13,20,3,23,33,35,0,10,1,9,5,32,4,8,39,45, 29,14,15,40]= (1+\\///\\\//..$=);$h[pop];}

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://87656]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2023-03-23 23:28 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.