Open In App

What is Obfuscation?

Obfuscation is a well-known term in software engineering. It is the concealment of written code purposefully by the programmer. It is mainly done for the purposes of security by making it obscure to avoid tampering, hide implicit values or conceal the logic used. One can obfuscate code with the help of language-specific deobfuscators that convert into meaningful code.

For example:



How to obfuscate code in apps?
To understand obfuscation, we need to know how Android and Java implement this in-app formation. There are two ways to obfuscate code in apps:

  1. Shrinking: It helps detect and safely remove unused classes, fields, methods, and attributes from the app’s release build.
  2. Optimization: It helps in inspecting and rewriting the code to reduce its size. For example, if an optimizer detects an if-else statement in which the else {} statement is never used, the code for the else statement is removed. Examples of code shrinkers and optimizers are ProGuard for both Java and Android and R8 for Android.

How to determine quality of an obfuscation method?
The quality of an obfuscation method is determined by the combination of its potency, resilience, stealth and cost.



  1. Stealth: It is necessary to hide the flow of control of a program.
  2. Cost: Cost-effectiveness is necessary so that an obfuscation technique can be applied on a large scale over several similar applications.
  3. Potency: Potency defines to what degree the transformed code is more obscure than the original. Software complexity metrics define various complexity measures for software, such as the number of predicates it contains, depth of its inheritance tree, nesting levels, etc. While the goal of good software design is to minimize complexity based on these parameters, the goal of obfuscation is to maximize it.
  4. Resilience: Resilience defines how well the transformed code can resist automated deobfuscation attacks. It is a combination of the programmer effort to create a deobfuscator and the time and space required by the deobfuscator. The highest degree of resilience is a one-way transformation that cannot be undone by a deobfuscator. An example is when the obfuscation removes information such as source code formatting.

Advantages of Obfuscation:

Disadvantages of Obfuscation:
Obfuscation is also used by cybercriminals. Let’s see how to protect ourselves from them.


Article Tags :