in reply to Perl in a box
No explanation needed#!/usr/bin/perl -w use strict;
Put all of the characters from $_ into @_ in order after they've been lower cased, but no spaces.$_="Perl in a box"; for(/\S/g){ @_=(@_=>lc) }
Variable decalarationmy($i,$k)=(0,'');
Sets up the magic decoder ring for the first level encoding. For each character in @_, set a value in %_ for the key corresponding to the character to the offset in @_. i.e. $_{p} = 0, $_{e} = 1, etc.for(@_){ $_{$_}=$i++ }
Unset the input record separator and slurp in the encoded info in from DATA.undef $/; $_=<DATA>;
After blowing away all whitespace in the encoded data, loop over the data 2 characters at a time.s;\s;;g; for(/../g){
Split the characters into @k.my@k=/./g;
Reverse the characters in the array if the second one is not lower case.@k=(pop@k,@k)if($k[1]ne lc$k[1]);
Decode the letters in @k with the magic decoder ring to get 2 numbers.for my $k (@k){ $k=$_{lc$k}; }
Multiply the first number in @k by 10, add 30 and the first number in @k, turn it into a character and add it onto the string $k, which is different than the $k we used in the for loop above.$k.=chr(30+pop(@k)+10*pop(@k));
End the for(/../g) loop}
Assign $k to $_ so the substitution looks better and do the substitution to turn $_ into 20 character long lines.$_=$k; s|(.{20})|$1\n|g;
Eval the second obfuscated code. Wheew. Are we done yet? Nope. Here's what the second level decoder looks like:eval
In a slightly more readable form:$_=q[s;.*;94eae6e840 c2dcdee8d0cae440a0ca e4 d8 40 d0 c2 c6 d6 ca e4 14 ;s ;@ _= /. ./ g; fo r( @_ ){ $_ =c hr (( he x) >>1)}$_=join'',@_;pr int];s; |\n;;g;eval;
This code simply sets up more code that loops through the encoded string (The 94eae6.... string that is put into $_ inside the quoted code to be evaled) 2 characters at a time, turns those characters into a real hex value, which in turn is shifted right 1 bit and turned into a character. After all of the characters have been decoded, they are crammed together and printed. A nice head-scratcher.$_=q[ s;.*;94eae6e840c2dcdee8d0cae440a0cae4d840d0c2c6d6cae414;s; @_=/../g; for(@_){ $_=chr((hex)>>1); } $_=join'',@_; print ]; s; |\n;;g; eval;
|
|---|