Monday, March 21, 2011

[Cpp-Programming] Re: [Help] Obfuscated code printing a map !

Hi,

Obfuscation is fun, especially for school assignments. 

If you want to try your hand at this sort of thing, what you would normally do is begin with a plan for what you want the algorithm(s) to do, ie, define your output. Here you have two outputted characters (space or !) in predetermined positions in the console. You're not limited to a plain old map, though: I've even seen obfuscated flight simulators in a single line of (strange) code. After you've decided on what the program will do, write it clearly and neatly. Work backwards from this version to your obfuscated version. Replace long var names with single-letter names. Replace any statements with their shortened versions (x?y:z), whenever possible. Make use of the less-well-known corners of the language ( for(;;) ). If there is a shortcut for one of your statements, or a legal-but-ugly version, use it! If you are outputting a boring old string as this program is, translate the clear ascii to an algorithm, perhaps a hashing function. One could speculate that the author of the India Map started with the India Map and converted it into the mishmash he ended up with. Finally, remove all clarifying whitespace. The sky (and compiler) is the limit.

In short, it is unlikely that the author of this program knew what to write just off-the-cuff. A bit of cat herding is generally involved.

Best of luck!

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

0 Comments:

Post a Comment

<< Home