5th Obfuscated Perl Contest Winners
strredwolf points out that
we have winners
of the Fifth Annual Obfuscated Perl Contest, noting, "Unfortunately, my virtual machine didn't win."
(Insert loser-condolences here.) BTW, I noticed problems with the code as printed: the winner of category 2 lacks a terminal quote, and I couldn't get the category 3 winner to compile even after fiddling with whitespace. Put up a webpage with code I can copy-paste-and-run,
email me,
and I'll update this story with your link.
is like hunting sea turtles. When they are laying eggs. On a beach. With a machine gun.
:)
Add an undermounted grenade launcher, and you've got the Obfuscated LISP contest.
I like you, Stuart. You're not like everyone else, here, at Slashdot.
This is not a flamebait.
Anyone can run Perl code through a perl-built obfuscator. Heck, one of the winning entries was an obfuscated perl-built obfuscator. How... imaginative.
I have lost my hardcopy of the Obfuscated C contest entries, but it seemed like they had a lot more spirit, and thought about the artistic side, on more than one level.
For example, one winner of Obfuscated C wrote a simple maze generator. However, the source code to the maze generator was itself a maze, with whitespace passages going up and across and down through the code. To top it off, those whitespace passages that cut through the code spelled out the word "MAZE", if you stood back far enough to see it. The main variables used were m, a, z and e, as well.
The closest to 'artistic' Perl source that I have seen is the "RSA Dolphin," where the RSA algorithm is formatted to have the silhouette of a dolphin. That's still only one level of art.
[
It has been done. You can now write perl in Latin.
Quattuor res in hoc mundo sanctae sunt: libri, liberi, libertas et liberalitas.
#!/usr/bin/perl /bush/; /gore/;
while (<BALLOT>) {
$bush++ if
$gore++ if
$gore++ if $chad{$pregnant};
$gore++ if $chad{$hanging};
}
For example, a Perl regular expression for matching can be plenty painfull to read... but it replaces 3 pages of nested and snarled looping in C++. Hardly an easy read either, and lots more opportunity for defect. You can use the regular expressions in C++, but they might not work (at least not the ones I tried) and will be even uglier...
Also, while Perl is weakly typed and does not declare types (or even necessarily variables), you still can know the difference when you need to. Consider the two examples below.
What does the perl do? Compare the number in $foo to the number in $bar. If it were comparing strings, it would have used the "eq" operator instead of the "==" operator.
In C++, who knows what is being compared unless you can track down the class declaration for foo and bar. Further, this class definition probably inherited from about 3 other levels of classes, each of which must be checked to see who (if anyone) overloaded the "==" operator. The base class probably used a template, which you have to find. Then, if you can even find the headers for all the clases and the template, you get to parse the actual overload for the "==" operator to see what on earth it is doing.
Granted, the C++ example has considerably more complexity... but either language can be completely and equally illegible.
The more I use C++, the more I like Java, but that's a different topic...
Bill
Mathematically impossible requirements are technically not against policy.
I'd suggest an Obsfucated English Contest, with extra points for correct grammar... but the more I read, the more I become quite certain that English is Infinitely Obsfucatable.
---
Good judgment comes from experience.
Experience comes from bad judgment.
I still have a copy of the IOCCC entry which consisted of an ASCII-art circle drawn inside main().
The program calculated an approximation of pi by figuring out the surface area of its own source code. The bigger the circle, the more accurate the approximation.
I think even the Jargon File mentions that one as an example of true obfuscation. The Perl entries are just... sophmoric.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
Hey, anyone can splatter paint on a canvas. Only Jackson Pollack could make it art.
:-)
Besides, the joke now is to either come up with an off-the-wall program in the first place (I never would have thought of Frogger in readable Perl, let alone that mess), or pull in the strangest form of obfuscation (Mayan numerals!?)
I still think the ultimate challenge would be obfuscated Python. Real artists would know what to do with significant whitespace!
We're not scare-mongering/This is really happening - Radiohead
This sig intentionally left blank.
I can't get any of the results to compile :( Not sure if that's an error on my side or on the webmaster for not putting the code in right. Anyone got any of these to compile and run properly? Links?
are all here.
They should demand that each semi-colon has a return character- it obfuscates obfuscation! Any code can be made 'unreadable' in this manner.REAL code obfuscation is a fine art, and I should be able to appreciate it on it's own terms.
love is just extroverted narcissism
Put up a webpage with code I can copy-paste-and-run, email me, and I'll update this story with your link.
/.
Thanks, but no thanks. I may as well just unplug my webserver -- the end result is roughly the same as posting a link to it on the front page of
-j
Unfortunately, I have to agree completely... it's +5 insightful now! Yeesh...
2 1337 4 u!
Well, I tried to paste it, but couldn't get it to work out in fixed-width font. The link to the author is here, and he explains how he came up with it.
Very interesting reading on maze theory.
You quitting proves that the karma kap worked. The most annoying of the whores shut up. --CmdrTaco
What about obfuscated OISC?
You've heard of RISC, Reduced Instruction Set Computers? Well, here is the concept taken to its logical extreme -- an emulator for a computer with just one (1) instruction (Subtract and Branch if Negative)! Sample programs in the OISC machine language are included.
ESR has an OSIC emulator.
cpeterso
obfuscation by eliminiating white spaces is not obfuscation, i will like the competitions to allow all entries to support white spaces, but the white spaces will not be counted, thus for a 512 byte compo, your actually code might be 800 bytes formatted like a real code, but when all the white spaces are removed, it willhave to be equal or less than 512 to qualify. That is when I truely adore obfuscated code, basically, code that looks like code, yet for the love of your life, you can't figure it out. just my opinion. :> btw, i can't wait for someone to take some perl code, encoded it in perl bytecode, and some how have perl jump to that code ;)
------ Curiosity killed the cat. {satisfaction brought it back | it didn't die ignorant | lack of it is killing mankind
... learn Common Lisp. Seriously. XML is really just S-expressions (in drag, with redundant, overblown syntax - see here; (sorry about the pdf)), so why not use a language designed for munging them?
Perl and XML don't really get along well, primarily because Perl and arbitrarily nested data structures don't really get along well (see here if you want a less biased, but still discouraging opinion).
Strangely enough, Java and XML aren't getting along as well as one would think, if this article on the JDOM project is any indication. Java also has the shifting sands problem - vendor-controlled standards are evil, no matter who the vendor is.
Common Lisp has an ANSI standard that hasn't changed since 1995, open-source multi-threaded web servers that you can add native code to on the fly (see AllegroServe or CL-HTTP) and a lot of other good stuff that I don't have time to list here.
To a Lisp hacker, XML is S-expressions in drag.
Just add a quote at the end yourself. Then it compiles without error
Have you read my journal today?
I'm not a programmer, but that seems to be cheating. Too many of the entries rely on self-extracting or self-decrypting code. Perhaps the contest judges should have separate categories for obfuscated programs which aren't self-modifying, or at least aren't compressed or encrypted.
Yes, I have to say I was very impressed with these scripts. It's a display of impressive talent when your code is so obfuscated that even the compiler can't figure it out.
Dang, you (sort of) beat me to it.
I was going to say that an obfuscated Perl contest made about as much sense as an obfuscated APL contest. I mean, how could you tell?
(BTW, I did APL tech support for a couple of years. It is possible to write unobfuscated APL, but actually seeing an unobfuscated APL program "in the wild" is about as likely as seeing an unobfuscated Perl script.)
APL is a terminal disease
-- joke dating back to when APL was run on mainframes from terminals with wierd character sets.
-- Alastair
and now I'm going to go into the corner and cry or maybe laugh I just don't know. In truth this is pretty cool because while you can write really good code with Perl you can also produce well this stuff. Now I'm just looking forward to the day when I can read these programs. BTW ,and yes this is on topic if you think about it, how many others would like to see a O'Reilly slashbox. I know I would.
Cypherpunks: Civil Liberty Through Complex Mathematics. Those who live by the sword die by the arrow.
Envision just what these
Really did, I could
Let my machine try and run them...
ChAoS
WARNING: May contain traces of nut
The coolest obfuscated C program I ever saw was a tic tac toe program. Basically, each time you ran it, it outputted source code in the form of a tic tac toe board. To get it to play the next move, you compiled the current board and ran it again.
(At least, this is how I remember it. Somebody correct me if I'm wrong).
-- Will quantum computers run imaginary-time operating systems?
- hunting turtles
- laying eggs
- on beach
- with machine gun
and not- hunting turtles
- laying eggs
- on beach
- with machine gun
Sorry.--
Yep, I took third place in the first section of the contest, which was to write a game in Perl in 512 bytes or less. I love game programming, and I love Perl, and the contest was really a lot of fun. I'm proud of what I did. To all those who are clever and say that Perl is obfuscated in and of itself, I disagree. I think writing obfuscated Perl *WELL* requires vast knowledge of the language, including obscure little tricks, weird regexps, etc, and HOW to use them effectively. Not me, though... I just wrote a game and made sure it was 512 bytes (which isn't as easy as it sounds to maximize the "game" part and minimize the bytes). Adam
On the surface of mars while little elfin-faced faeries dance around like they're on a mixture of speed and shrooms.... then you have the description of Obfuscated Prolog...
Pleasure in the job puts perfection in the work.
There was never a genius without a tincture of madness.
Aris
nope, you can't do that. you could do stuff like
#define bar {
#define baz }
but it's not possible to use special characters or reserved words in the define. defines are "cute" but they're not really obfuscated anyway, since you can just grab the output of the preprocessor and see the unmunged source.
--
"Don't trolls get tired?"
check it out here
Abstract
This paper describes a Perl module -- Lingua::Romana::Perligata -- that makes it possible to write Perl programs in Latin. A plausible rationale for wanting to do such a thing is provided, along with a comprehensive overview of the syntax and semantics of Latinized Perl. The paper also explains the special source filtering and parsing techniques required to efficiently interpret a programming language in which the syntax is (largely) non-positional.
What I want to see is obfuscated Pascal, or better Modula 2, contest. This would be sport, gentlemen. Obfuscated Perl isn't, I'm sorry.
--
okay, you can
#define long {
and then when you declare a long, you're fscked. you can't
#define long {
#define baz long
and then use 'baz bar' to set bar to be a long.
you also can't
#define { } (just won't work, illegal macro name)
any obfuscation done this way, is really just "cute" obfuscation anyway. I mean, you have to provide an easily readable translation key.
--
"Don't trolls get tired?"
You don't need to be a genius to write utterly incomprehensible perl code.... Bah, this comment is too obvious. Look, I'll start again.
I would like to see a contest for programs that are readable and work even though they shouldn't, like if you create a c program which includes a bunch of macros
#define like {
#define ok }
#define um ;
#define int dude
etc
then you can write fairly serious programs in valley speak. I started doing this once, but then I got a life..
http://rareformnewmedia.com/
I like Perl. Quick, dirty, and flexible. I'm sure the "C is best for everything, blah blah blah" crowd will scoff, but for protoyping Web apps, and manipulating text files(which is my main thang) it rocks the house.
I think Flash, Perl, and XML are my favourite ingredients. Once I get it worked out, sure, I'll call up my C-loving friends to bum the code down to a fast binary, but I aint got the time or patience to screw around.
Are there any Perl people out there who can tell me a good reason to learn PHP too? Or should I go the other direction and pick up some Java (considering I want to focus on XML and Web development)?
Don't take it as a dis, folx. I love you weird C people, and all your stories about that time you wrote a routine in a assembler...
Alas these weren't all the best examples.
As just another perl hacker I found the best of show truly pathetic. The rest were fairly readable as soon as you'd put a few newlines in.
The quality is lower than the IOCCC, certainly, but I think that is because Perl is inherantly noisier (as in SNR) if you use all the inbuilt features, so people go to less effort to make it ugly, it's most of the way there already.
Truly obfuscated Perl uses an unfathomable algorithm as well as undecipherable presentation.
FatPhil
(Repeated IOCCC loser!)
Also FatPhil on SoylentNews, id 863
Just do what I do, create an extra user that has no access to anything important. IMHO, it's good policy to seperate your activities as different users. For example: edit (runs nothing but vi or emacs, has sole write access to your personal source code), compile (has read access to your edit area), archive (which backs up your code, so you can't even accidentally delete your own stuff), test (has read access to compile results, write access only to its own personal scratch area), toys (for internet access and games; has neither read nor write access to anything important), and root (as the default user, with "root" as the password, for letting other people telnet in and run whatever they want). The key to security is in sensible division of roles among special-purpose pseudousers.
Better yet, pick up an old 486 for fun stuff like screwing around with experimental file systems.
--------
I know perl. I love perl. I pride myself in writing self-commenting code that makes sense when I pick up a project I have abandonded for two years.
Obfuscated code proves to me that I KNOW NOTHING. The Frogger entry parses. And does nothing. It seems to be filled with ANSI codes. But it still does nothing for me, and I can't figure out why (it would do anythin). The inner-beauty entry fails to parse (for me). The final, Best Of Show Entry, is actually interesting, makes some sort of sense, and does what it is supposed to. It gains it's obfuscated title because of it's approach, not it's writing or syntax.
I thought I had a firm grasp on perl syntax. I thought I could debug any program less than 4k in 30 seconds. Umm...this contest always proves me wrong.
If nothing else, this proves that you can write an open-source perl trojan horse that even I might run to see what it does...
-Ignore this post, please- NoOneSpecial
As opposed to what?
(8-DCS)
The tic tac toe program where the source is the board (recompile for next move)
The program that flips a square text file about the main diagonal, and when fed its own source produces a different c program that does the smae via a different method
A LISP compiler (in under 1KB)
The adventure game where your commands are compiler options and the response is the errors
and my favorite, the first ever winner:
it's a one-line program that confuses the Slash code :(. It's the first one, by an anonymous author.
so for those interested, its worth a read. I think Slashdot covers it every year, but I don't really feel like digging up links. happy reading (err... confusion?)!
When I heard about this, I was pretty surprised. I thought "obfuscated Perl" was redundant. If they want a challenge, how about a "Documented Perl" contest?
In this, the entrants must write a non-trivial application, entirely in Perl, that has to be completely portable across at least 3 implementations (including one on Windows) and at least 25,000 lines of code (not counting comments).
Judges will introduce a bug into each program that would be obvious if you knew what the program did. Each bug *must* involve a cascade from an ambiguous or subtle misuse one of Perl's much-heralded "Do what I mean" functions.
A panel of experienced Perl programmers will be given the programs to debug. The program that takes the least average time to debug wins.
That's a contest.
idontthinkremovingwhitespaceisreallyachallengeimea n
y be
t he
i gure
e r
itmakesthispostalittlemoreconfusingthannormalma
itwouldbeevenmoreconfusingifitookmyfingersoffof
homekeyskiijdkujruyudfromthatyoushouldbeabletof
outwhatkindofkeyboardimtypingondamnlamenessfilt
Too bad the IOCCC is not going so well. They've been sitting on the entries since April. (I'm not blaming them since I understand that they have their own life outside of the IOCCC.) But it's sad to see it in limbo. Recently, there was a message on that site from one of the judges saying that most of the other judges were no longer interested in judging the contest. (that message has since been removed)
AG
I would argue that any program written in a language you don't understand or with techniques you don't understand is Obfuscated to some degree.
I've seen beautiful, easy to read and understand Perl code, and I've seen Perl code that should cause the machine it was written on to burst into flame. Hell, I've written both of the above.
It all really depends on the effort you put into it, just like in any language.
I've written Perl and C that didn't make sense to me the next day, and I've written both that were obvious to everyone that's ever seen them.
It's the coders use of the language that makes the critial difference I think.
--Ty
Perl isn't really designed to stop this sort of abuse/artform/whatever. So Obfuscated perl contests don't really hold that much interest to me. While I'm sure writing this stuff isn't easy, it dosn't really seam super dificult within the confines of the language.
Obfuscated C however, is a bit more difficult, and the results are therefore more appealing to me.
C of course, is prone to abuses to (#define...), what I'd really, really like to see is an obfuscated java contest. Its harder to mess with java then it is with those other languages, I wonder what ingenious hackers would be able to think up there...
ReadThe ReflectionEngine, a cyberpunk style n