in reply to Line Noise
This is really, really, cool. I'm going to desecrate it by deobfuscating it merely because it gave me a deeper appreciation of how cool it is (and because I feel somewhat clever for being able to).
First, let's make it a little more readable...
The only changes other than adding whitespace are that I turned the literal newline in the first translation in the bare block into an escaped octal (\012), and I changed a bunch of substitution and transliteration and quote delimiters. Oh yeah, and I inverted the condition at the end of the block.use strict; $\=$/; $_=''; s//#?=>$":}\~>\\!;/; $/ =~ s//s{;};$")!{$"\\:<_!;/e; y{%*-.$'&(#-<}{@-~}s; { y(;-?)[\012r-{)!]s; y/T-_/`-|/; y/{-~/l-}/; redo if s/!/Y</g } print
Now, taking that bad boy line by line...
These are boring: we set the output record separator to something approximating a newline (platform dependent) so we get a newline at the end of the final printout (also achievable using the -l switch, but less obfuscated that way :-), and we set $_ to nothing in a strict compliant manner.use strict; $\=$/; $_='';
This sets $_ to something interesting--remember, $" is a space for most purposes (says perlvar) so $_ is now "#?=> :}\~>\!;".s//#?=>$":}\~>\\!;/;
is a mean, nasty, dirtyminded version of$/ =~ s//s{;};$")!{$"\\:<_!;/e;
which really meanss/;/$")!{$"\\:<_!/;
orsubstr($_,-1)= $". ')!{' . $" . '\:<_!';
Which, in total, means that the first few lines break down to:substr($_,-1)= ' )!{ \:<_!';
And a glimmer of where we're going seems to appear. (Note: we also screwed up our input record separator back there by prepending a "1" to it, owing to the sucessful subsitution inside the substitution, but we don't care.)$_ = "#?=> :}~>\! )!{ \:<_!"
Update: killinrax points out that I missed this one: there was originally a literal newline in the left side of the substitution, so we've actually changed it to 1, rather than prepending a 1. D'oh!
Now, it gets interesting.
To make this easier to read, let's put in ASCII escapes:y{%*-.$'&(#-<}{@-~}s;
Now, the first few things on the left side don't appear in $_, so we can take them out. The actual sequence on the left side is "%*+'-.$'&(" and none of those appears in $_, so we take out those 9 characters and the first nine on the right side, and we havey{%\052-\056$'&(\043-\074}{\100-\176}s;
In fact, when we take out the parts that never get applied, what we really have isy{\043-\074}{\112-\176}s;
and $_ now reads "J?=> a}~>\! P!{ \ac_!".y/#):</JPac/;
Now we enter a bare block, which we will redo until there are no more !'s in $_ (which means we go through it twice, since that global substitution only succeeds once).
meansy(;-?)[\012r-{)!]s;
but applying the same principles we did above, we gettr/\073-\077/\012r-{)!/s;
and then (since the right side is much longer than the left)tr/\074-\077/r-{)!/s;
Which leaves us (the first time) with "Just a}~t\! P!{ \ac_!" as our string.tr/\074-\077/r-u/s; or tr(<=>?)(rstu);
Next we have two very similar transliterations, which tranlate to
of which the only useful parts are going to bey/T-Z[\\]^_/`a-z{|/; y/{|}~/l-z{|}~/;
This leaves us with "Just anoth! P!l hack!", to which we apply the substitutiony/Y\\_/ehk/; y/{}~/lno/;
Then (since it succeeds) we redo the block, starting with "Just anothY< PY<l hackY<" and ending with "Just another Perl hacker". Since there are no more !s to apply the substitution to, it fails, and we exit the block, and print, getting our answer followed by a newline, because we set the output record separator to "\n" (assuming we're in Unix) way back at the top--remember that? :-)s/!/Y</;
So if we put it back together, the minimalist version (doing every operation, in almost the same order) is
And the funny thing is, it's still almost impossible to read! All in all, an awesome obfu!#!/usr/bin/perl -lw use strict; $_=''; s//#?=> :}\~>\\!;/; substr($_,-1)= ' )!{ \:<_!'; y/#):</JPac/; s/!/Y</g; y(<=>?)(rstu); y/Y\\_/ehk/; y/{}~/lno/; print;
|
---|