Obfuscated code is a source or machine code that is deliberately written to be difficult for humans to understand. Obfuscated code can be used for a variety of reasons, and there are many pros and cons to the practice. If you write code and are interested in learning more about the benefits and disadvantages of writing obfuscated code, continue reading.
Pro: Security
The biggest advantage many people find in using obfuscated code is the security benefits. Obfuscated code is designed specifically to be difficult to replicate or decipher. If you want to protect your intellectual property, obfuscated code can do just that. When you utilize obfuscated code, you will be discouraging theft, just as you do by password protecting your flash drive. If somebody wants to steal your original code, they will first have to unpack the obfuscated version, which could take quite a bit of time. Your code will be more difficult to reverse-engineer. This means that you will be safe from attacks by casual hackers who are not willing to deal with the obfuscated code. However, some experts will argue that obfuscated code is not infallible. If your code is desirable enough, it could be deciphered with significant time and effort. For most average users, obfuscation is unnecessary. Be sure to consider both sides to this advantage before you alter your code.
Con: Maintainability
Obfuscation involves taking a particular code and making it, essentially, illegible to others. This is often done by replacing certain commands, symbols or words in the code with a different character or word that is nonsensical. These characters and words will still act like the regular source code. However, it will be nearly impossible to decipher their meaning from just looking at it. Although this offers security for the code, it also requires a certain level expertise when performing maintenance on the code. Only the person who writes the code would be able to adjust it after it has been obfuscated. If you are working on an individual project, this should not be a problem. However, if you are working on an Openflow team or as part of a job, obfuscated code can alienate potential helping hands. Consider this disadvantage the next time you want to utilize obfuscated code.
Pro: Optimized Code
In addition to providing extra security, obfuscated code can also optimize your original code. The obfuscation process requires a careful understanding of the code language. As you are going over the code to be obfuscated, you may soon find unnecessary information that can be discarded. An obfuscation service can do the same thing. Many obfuscators are free to use. They will take your original source code and obfuscate it in an instant. This process will also often lead to optimized code. Obfuscation programs will remove useless metadata. They will eliminate dead code or duplicate information, as well. Compressing your code down to only the most essential parts is one of the major benefits of using obfuscated code.
Con: Bugs
Alongside maintenance issues, obfuscated code can make it difficult to troubleshoot your web page or program when there is an issue with your recent install MAMP plugin. With obfuscated code, it will be difficult for users to submit accurate bug reports. This code is so illegible that it can be difficult even for the original programmer to find the real issue. If your code is not completely perfect when you obfuscate it, you may find yourself frustrated by the debugging process later on. If you write code and you are not interested in having to fix bugs in an obfuscated program, this would be a big disadvantage. Be sure to consider the extra effort that is needed to maintain and debug an obfuscated code. You may find that it is not worth the hassle.
Pro: Track Illegal Copies
In addition to providing additional security just on format alone, obfuscated code can help you track illicit copies of your code, much like DidTheyReadIt does for email. If you use obfuscated code for a particular project, you can immediately identify any changes to it. Assuming your code has been supplied to multiple users, you can even identify where the illegal copy originated. This is a huge benefit, particularly if you are concerned about the integrity of your work.
International Obfuscated C Code Contest
The International Obfuscated C Code Contest is an annual computer programming contest specifically for creations made with obfuscated C code. The competition allows computer training competitors to have their creation to be evaluated by an anonymous panel of judges. International Obfuscated Code Contest winners are awarded in a number of areas including “worst abuse of the C preprocessor,” or “most erratic behavior.” Winners have their name announced on the IOCCC website as prize for their success. Once you get the hang of obfuscated code, you should definitely consider entering this fun obfuscated code contest.
Obfuscated code is made to be difficult to decipher. With this comes some significant pros and cons. When considering obfuscated code, remember that you may have to decide between security and maintenance, especially if you use manual number keypad entry methods. If you have any other pros or cons of obfuscated code, leave them in the comments below.
Photo from http://1.bp.blogspot.com/-BEwzyZ-2oPY/UU56RQelwPI/AAAAAAAAAbg/dpubOgvTPME/s1600/bh4.png