foreach (split q;\;;,qq.'s;q,s;q,q;3g;sg;'g;{i;{);
}{;sg;3g;7i;i';q,g;qq};qq);ii;i};qq{;q,q;q,,;3g;',;q,q;qqs;q,';.. ord q'
'7'gx;print chr}

(should be self explanatory)

In response to bis's deconstruction, the extra /g, /i and /gx's are just there to add even more apparent randomness, without it the pattern of substitutions becomes a little too obvious (or so it seemed to me, after five minutes of writing this my eyes went a bit funny).

And no, this isn't real obfuscation, it's just normal code hiding as line noise. There's not even any use of references. I was going to encode the string into something that looked like perl statements, but it just got messy.

btw, I'm waiting for The *REAL* *REAL* Obfuscated Perl to better this.

And for those of you who ran this, but were too lazy to figure out what it was doing, and those who didn't run it, but are marvelling at its obfuscation anyway, here is an equivalent version:
foreach $_ (split / /, "'s q,s q,q 3g sg 'g {i {) }{ sg 3g 7i i' q,g "
                       . "qq} qq) ii i} qq{ q,q q,, 3g ', q,q qqs q,' "
                       . ord "\n")
    $_ =~ s/\)/5/i;
    $_ =~ s/\'/8/i;
    $_ =~ s/q/1/g;
    $_ =~ s/s/4/g;
    $_ =~ s/,/0/g;
    $_ =~ s/{/6/g;
    $_ =~ s/g/2/g;
    $_ =~ s/i/9/g;
    $_ =~ s/}/7/gx;
    print chr($_);

The "cleanups" I made:

  • removed the q{string} and qq{string} syntax, and replaced it with more normal "string" syntax.
  • changed the pattern being used to split from ";" to " ", which is more readable.
  • got rid of all implicit arguments
  • changed the substitutions from the forms;;; to s///. (Note that most of the gs and all of the is in the substitutions are not technically necessary. In addition, the gx on the last substitution is extraneous; it could be just g, or even left off entirely.)
  • added newlines and indentation
  • broke the main string into two pieces, so that it wouldn't screw up E2's width

So what the program does is this:

  1. starts with a string that is a list of ASCII values for the string "The *REAL* Obfuscated Perl\n", where each digit of each ASCII value has been replaced by a letter or symbol. (The first symbol, "'s", stands for "84", which is the ASCII value for "T".)
  2. splits this string into the list of encoded ASCII values
  3. decodes each value, by substituting the appropriate digit for each letter/symbol
  4. prints out the character represented by the decoded ASCII value


I suppose now we will all have to wait for The *REAL* *REAL* Obfuscated Perl... ("E2 source code, what?")

As any theoretician knows, success at anything, even obfuscation, is attained through the use of sophisticated algorithms.

#!/usr/local/bin/perl -w
use strict;
my$t=",rtlr\n h ahkP tcraneeeusoJ";
my$s=join'',sort split//,$t;
while ($s=~/(.)\1*/sg){my$l=$1;push@t,(pos$t)-1 while$t=~/$l/g}
my$i=0;print map{substr($s,$i=$t[$i],1)}(1..@t)

Simple, concise, easy to understand. Exercise: modify the value assigned to $t so that the program prints your own name.

Log in or registerto write something here or to contact authors.