To obfuscate is to to render
obfuscated by a process of
obfuscation. To make
unclear, to
confuse. To
darken, to
cloud, to make partly
obscure. To present to viewers something hazy, as
through a glass, darkly.
e.g. Though I was on top of the skyscraper, my view of the horizon was obfuscated by the thick pollution.
Enron’s true financial state was deliberately obfuscated by the company's byzantine structure.
The artist has a message in this work, but it is obfuscated in order to make the viewer struggle to extract the meaning.
Say what you mean, don't confuse the issue with your obfuscations!
In computer programming terms, obfuscated code is source code that is deliberately rendered as difficult as possible for a human being to read, while still being machine readable, compiling to an identical or equivalent program to the clear text.
See also the obfuscated c contest and its imitators, which award prizes to the most bizarre and incomprehensible programs in particular languages. That link has a few good examples.
Code obfuscation techniques from simple to advanced
Or obfuscation made clear.
Obfuscation starts with pessimal formatting.
The simplest procedure is to remove all comments. The compiler or interpreter will ignore them anyway.
Most programming languages (excepting python) are insensitive to spaces and returns, and so they can be omitted, turning code such as
while (z < 3) do
{
z = somefn();
}
into
while(z<3)do{z=somefn();}
There are a few places were white space is needed between a pair of textual tokens, e.g. int a; cannot be rewritten as inta; Here white space is reduced to a constant single space for brevity and regularity.
It is indeed horrifying to see a nicely laid out source file condensed into a short dense rectangular wad of text. However this kind of obfuscation is superficial, it can be reversed (except for the lost comments) by applying a code formatting program.
Some languages (e.g. Delphi) are not case sensitive, and so in these languages everything can be converted into the same case.
The next step is to look at the names of variables, functions and objects in the code. Make them alphabetic, or even better, numeric. MyInterestRate = getInterestRate(); is so much easier to read than _12 = _13(); yet they are identical as far as your compiler is concerned.
Up to now, the techniques of obfuscation make the code more regular. Beyond this that changes – this is where the tricks come in that separate a normal obfuscated program from a contest winner come into play. One must code in a way that is deceptive, unpredictable and complex even when the code is well formatted and well named. Complex and subtle algorithyms are what you need - they are harder to understand even when nicely commented, named and laid out. Which they won't be.
But why would you want to do this?
For fun.
To show off how geeky you are.
To win a contest
For job security. If no one else can read your code, only you can fix it, right?
I'd fire you instantly if you tried to pull that one on me.
For general closed-mindedness. Bear in mind that some interpreted languages (e.g. the evil
javascript) are distributed in source-code form, and some misguided individuals think it better if that code is unreadable by any human on the client.