Originally published on: Tue, 07 Jul 2009 11:33:26 +0000
In 1997, I entered a contest held by the publication The Perl Journal. It was their 1st annual Obfuscated Perl coding contest.
My entry in the category for simply printing "The Perl Journal" took 2nd place. ( You can now find this entry in the O'Reilly book Games, Diversions, and Perl Culture ).
I would like to briefly explain the genesis of my entry.
I had thought about listing my entry here, but I'm pretty certain that I don't own any kind of publication rights. One can still find it with a little Googling. However, the first two phases of the entry are still mine.
The program began with an idea that I had that involved allowing the Perl program read data from its own set of comments. The code opens itself as a file, loads its own source ( including the comments ).
To confuse the reader, I small p-machine and interpreted a short program to read from the comments and display The Perl Journal.
The associative array %c holds the code for the six instruction machine.
The symbolic instructions are as follows:
The p-machine program that performed the output was embedded in the Perl code as the string:
Once I had the p-machine interpreter, I needed to make the code more unreadable. I took half of the top portion of the code and half of the lower portion and then interlaced the characters of each. I added a for loop to the final code that separated the two halves, concatenated them, then called eval() to interpret the original program.
Unless otherwise noted, all code and text entries are Copyright ©2009 by James K. Lawless
Save to del.icio.us
Save to StumbleUpon
Digg it
Save to Reddit
Share on Facebook
Share on Twitter
More bookmarks
Subscribe!
Auto Save Clipboard Images Redux
Extending SpiderMonkey JavaScript on Windows
Rhino JavaScript to EXE with launch4j
Compiling Rhino JavaScript to Java
Directory Traversal in Rhino JavaScript
A Command-Line MP3 Player for Windows
Auto Save Images from the Clipboard
Java in a Windows EXE with launch4j
An Interview with Tom Zimmer: Forth System Developer
Setting Windows Console Text Colors in C
An Interview with Tom Zimmer: Forth System Developer
Shrouding CSharp and Java Source Code with AWK
Choose your own Adventure with Sinatra
Internet Protocols and Rhino JavaScript
Stacking Images with PerlMagick
MicroISV on a Shoestring
DadHacker
The Bottom Feeder
Writin' That Code!
The Recursive ISV
The Thomsen Blog
Prototypically Speaking
The Reinvigorated Programmer