Everything2
Near Matches
Ignore Exact
Full Text
Everything2

The *REAL* Obfuscated Perl

created by jdube

(idea) by paranoidfish (4.7 y) (print)   ?   (I like it!) Thu Aug 10 2000 at 10:46:21

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'
'){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}

(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.


(idea) by bis (1.1 mon) (print)   ?   (I like it!) Fri Sep 08 2000 at 19:09:24

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

*sigh*.

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


(person) by ariels (1.9 d) (print)   ?   (I like it!) 2 C!s Wed Feb 27 2002 at 13:44:56

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;
my(@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.


printable version
chaos

Everything is a perl script 10 steps to becoming a Perl Ninja World's most flexible programming language obfuscated perl
$_ I hate Perl RSA Secret Key Challenge recursive lather, rinse, repeat
Look out Haskell, it's real! perl poetry x86 Real Mode Obfuscation
Perl Real women, not models, belong in magazines use strict The owls are not what they seem
Node your Code: The Everything Engine in Action mandelbrot latex stdin
Real Men Don't Eat Quiche Best of the Best SelfGOL Nodeshell
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Look at this mess the Death Borg made!
The 1989 U.S. Invasion of Panama
Hot chocolate
Tao Te Ching
Everything Editor Logs
All the dead artists
A beam from an angry star
The summer after high school
Henry VIII
Scenes from a Memory
Eddie would go
Glamis Castle
Gargouille
Religious dietary laws and restraints
New Writeups
Heitah
Why I love Everything2(person)
trixingee
Dungeon Mastering for the first time(idea)
Netrat0
It's Called Subtext, Honey(person)
eyeofthebeholder
The Dragon(idea)
Heitah
consist, comprise, constitute, or compose(idea)
Meezzio
Gotlandssnus(thing)
argv
Astral Plane(idea)
Madara
One Winged Angel(fiction)
Tom Rook
Talk is cheap(poetry)
shaogo
Adelle Davis(person)
Aerobe
race car g sfjsgsd(poetry)
Binah
Dream Log: July 5, 2008(dream)
StrawberryFrog
Forgotten things in space(idea)
antigravpussy
velvet revolution fairy tale(idea)
Heitah
Nerve agent VX(thing)
This page courtesy of The Everything Development Company