Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Just Another Unpatented Sequence

by tadman (Prior)
on Jul 31, 2002 at 19:38 UTC ( [id://186574]=obfuscated: print w/replies, xml ) Need Help??

Part of the Perl Genome Project?
$_=do{q}HHJHPAPAJJAJPJJHAAJJAAJHJAHAJPHJHAHPPJ HAAHHJJJHJPPHPHJAJPHAAPHAJJHHJHAHA}};\s+\s++s+ y?JAPH?0-3?;s;(.)(.)(.);(map{ord>0130?uc:(),uc }q{KnKttiIMRsROhOppllrr y ssLfL cWEdEaauujj}=~ /./g)[$1*16+$2*4+$3];eg;s;\w+;\L\u$&;g;{print}
With some inspiration from Meowchow.

Replies are listed 'Best First'.
Re: Just Another Unpatented Sequence
by belden (Friar) on Aug 05, 2002 at 22:54 UTC
    Part of the Perl Genome Project?
    :) Could very well be! tadman is starting with a small set of data, then expanding it, and indexing into it using values computed from $_. De-obfuscators would do well to pay attention to how q{K...}=~/./g behaves and maybe toss in a few print statements throughout the obfu.

    People who like to find out just how painstaking this obfu was for me to decode should just

    Thanks for this obfu, tadman - it was really a fun romp through perldoc, perlfaq, and some test code to figure out what you're doing here! At the risk of showing your tricks: how did you compute the indices and the @expanded_key/@key ? If by code, will you outline how it works? I drove myself silly yesterday trying to reverse-engineer such a program...

    blyman
    setenv EXINIT 'set noai ts=2'

      Nice work on the deconstruction.

      Just a few observations on the deconstruction. If you look very closely at the remapping ord comparision, it's actualy a little different from what you explained.

      It's based on meowchow's mapping function which expands a list of letters into a longer list. The trick was to take lower-case values and "double" them in the output map. Just to hide the obvious ASCII value used for 'Z' which is 90, I used 0130. Note that 0130 is octal 130, which is actually 88 and that corresponds to 'X'. That's close enough in this example, which has no 'X', 'Y' or 'Z' in the input data.

      Secondly, I think you incorrectly parsed the map. What it has to do is either return two copies of uc or it has to return a single copy. The ternary operator works like this:
      (ord > 88? uc : ()), uc
      Note that if the letter is lower case, you will get two uc list entries, otherwise you get an empty list which is not the same as undef. Also, the uc is important since some of the letters are lower-case. Your equivalent would be:
      if (ord($_) > 88) { return $_; # 'A' -> ('A') } else { return uc($_), uc($_); # 'a' -> ('A','A') }
      As for how the indexes were computed, check out the original thread and see how this solution evolved. The one I used was from meowchow, but it too is based on others.

      I just had to spice things up a bit with \s+\s++s+... It is a huge red herring. The leading backslash just returns a reference to the substitution result code, the trailing plus is for addition with the tr operator, and may as well be a comma or even a semi-colon. Using plus as a delimiter made it extra confusing, I thought. Oh, and the 's' on the end is also functionally useless, a decorative element thrown in for the sake of having one more 's'.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://186574]
Approved by silent11
Front-paged by Jazz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (None)
    As of 2024-04-25 03:56 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found