tags:

views:

377

answers:

6

So, I have a penchant for Easter Eggs... this dates back to me being part of the found community of the Easter Egg Archive.

However, I also do a lot of open source programming.

What I want to know is, what do you think is the best way to SYSTEMATICALLY and METHODICALLY obfuscate code.

Examples in PHP/Python/C/C++ preferred, but in other languages is fine, if the methodology is explained properly.

+3  A: 

In that case, you should use/write an "obfuscator". A program that does the job for you.

The Salamander Obfuscator can be used to obfuscate .Net programs, but it is more to prevent decompilation, thus not exactly what you need.

A good place to learn about obfuscation in C is International Obfuscated C Code Contest

Burkhard
The IOCCC has nothing to do with automated obfuscation.
shoosh
True. My line of thought was: knowing how to obfuscate helps to write an automated obfuscation mechanism. IOCCC may be an inspiration.
Burkhard
A: 

The question is how to create seemingly non-obfuscated code in plain sight (open source) without it appearing to perform another function.

Steganography: the art and science of writing hidden messages in such a way that no one apart from the sender and intended recipient even realizes there is a hidden message.
Schwern
+1  A: 

Some obvious methods:

  • remove comments and as much whitespace as you can without breaking things
  • join lines
  • rename variables and functions to be meaningless (preferably 1 character)
Hugh Allen
+3  A: 
  1. Compile the code with full optimization. Completely strip the binary.
  2. Use a decompiler on the code.

I can guarantee the result will be so utterly unreadable that you won't even be able to read it ;)

Dark Shikari
+1  A: 

For systematic and methodical obfuscation of code, you cannot beat Perl. If you want something that compiles to a binary, there is always APL.

If you are targeting the .NET framework, put your easter egg source code in a resource file as a binhex string. Then you can have one of your initialisaing routines fetch it, decode it and compile it into memory. You can invoke it using reflection.

If you need help with the technical aspects of compiling into memory and calling into the resultant assembly I can give you I library I wrote and a sample program that uses it.

You can use this technology to load plug-ins, which is a legit thing to do and reasonable in an initialiser.

Peter Wone
+1  A: 

In the spirit of renaming symbols: overuse scope and visibility rules by naming different variables with the same name.

mouviciel