This is called obfuscation.
What it does is that it performs a series of operations which don't affect the execution of the source code, but make it more difficult to read of a human.
For example, here are some commonly used obfuscation techniques:
With only those three basic techniques, this code:
public string GenerateFileName()
{
var basePath = this.FindBasePath();
do
{
var counter = this.CounterExists ? this.GetCounter() : 0;
var name = this.GenerateName(counter);
// If the file limit was exceeded, it indicates that something went wrong.
// Possible causes include two services running side by side on the same machine
// or two machines running the service using a share. Remember that the service
// should be bound to a directory which is not used by any other application.
if (counter > MaximumAllowedFiles)
{
throw new StorageThresholdException();
}
}
while (File.Exists(Path.Combine(basePath, name)));
}
becomes:
public string c(){var a=this.h();do{var b=this.k?this.b():0;var c=this.d(b);if(b>i){throw
new af();}}while(File.Exists(Path.Combine(a,c)));}
Less frequently used obfuscation techniques include but not limited to:
Encryption of strings,
Inlining (i.e. moving the body of a method in the method which was calling the first one),
Control flow obfuscation,
Encryption of source code (the effectiveness of this technique is highly disputed, since if the machine running the application can decrypt the source code in order to run it, the user of this machine can do it as well).
Of course, you shouldn't do the obfuscation yourself, but rather search for a tool which makes this for the language of your choice.
Note that some tools don't have obfuscation as their primary goal, but still can be used for that. Google Closure Compiler, for example, is intended to (1) perform static checking of the code and to (2) reduce the size of JavaScript files, but has a side effect of making source code quite unreadable.