Obfuscation is known in software developing. It describes an intentionally change of source code, to make it unhuman readable. The original source code is not retrievable. The goal ob obfuscation is it, to increase the effort of reverse engineering. To make the stealing of changing of source code more difficult up to impossible.
This means for script languages that the source code direct will get unrecognizable. For compiled source code, like the Assemblies in Unity, the source code will get obfuscated indirect. This means the compiled Assemblies will get unrecognizable.
So how does this work?
An Obfuscator goes through all namespaces, types, fields, properties, methods …. and gives them random names. For example the class “Entity” will get obfuscated to “azZte1”. Next, this new name for “Entity” gets shifted in an unreadable format. So it looks in the end like “”, like an empty string.
This is the main part of the obfuscation process and helps alot.
Additionally to increase the obfuscation process result, there are some more steps:
- String obfuscation:
The String obfuscation process is a bit more complicated. Normally the String gets encrypted with an encryption algorithm like, SHA-1 or AES. This will result in crazy byte arrays. For example: “This is an awesome Text!”, will get to “84 104 105 115 32 105 115 32 97 110 32 97 119 101 115 111 109 101 32 84 101 120 116 33”. This looks great, nobody knows how you encrypt it and can not decrypt it. But the problem is now, neither the computer knows how the real String is. So String obfuscation includes also the decryption of an String. To do this an decrypt method will get added to the source code. The problem now is, the computer knows how to decrypt is, but an Attacker can use this decrypt method too, to decrypt the String. So it needs much work to do an effective encryption and decryption to make it hard for the reverse engineer to read the real Strings.
- Random code:
To confuse reverse engineers, a obfuscator adds often random code, based on existing methods. So it is not well known which methods are the really used one and which not.
- Make classes unreadable for decompiler:
Now the source code is well obfuscated. But the attacker can still “look” at the obfuscated source code. To take him this privileg, the classes will get modified, that he will only “look” at funny nullpointer exception :).