Skip to main content

Impact on Assembly Size

Since obfuscation modifies dll code, the assembly size will change after obfuscation. Generally speaking, except for Symbol Obfus which reduces assembly size, all other obfuscation passes will increase assembly size, but each pass has different impacts.

We measured the impact of each pass on final dll size on our internal test assembly Tests.

Test Data

StatusFinal Size (KB)Size Increase Percentage
Original file6980%
All passes disabled681-2.4%
Const Encryption enabled94134.8%
Field Encryption enabled683-2.1%
Symbol Obfus enabled652-6.6%
Call Obfus enabled, Proxy Mode is Dispatch79413.8%
Call Obfus enabled, Proxy Mode is Delegate100143.4%
Expr Obfus enabled7527.7%
Eval Stack Obfus enabled, obfuscationPercentage=0.0579426.4%
Eval Stack Obfus enabled, obfuscationPercentage=1.03672426%
Control Flow Obfus enabled81917.3%
All passes enabled except Eval Stack Obfus, Call Obfus Proxy Mode is dispatch93834.4%
All passes enabled, Call Obfus Proxy Mode is dispatch, Eval Stack Obfus obfuscationPercentage=0.051464109%
All passes enabled, Call Obfus Proxy Mode is dispatch, Eval Stack Obfus obfuscationPercentage=0.52797300%

Several notes:

  • When all passes are disabled, the output assembly size is 17k smaller than when unobfuscated. We suspect this is due to different dll layout when re-exporting dll using dnlib compared to the original dll.
  • Field Encryption has almost no impact on obfuscated file size because by default no fields are encrypted. Field encryption only takes effect when explicitly specified for certain fields in rule files.

Conclusion

  • Eval Stack Obfus, Const Encryption, and Call Obfus (Delegate) passes have significant impact on final file size, while others have relatively small impact
  • If Eval Stack Obfus obfuscationPercentage=1.0, it will drastically affect final dll size. Therefore, the global default value of obfuscationPercentage (i.e., the obfuscationPercentage value configured in global in rule files) should not exceed 0.1.
  • Call Obfus choosing Proxy Mode as Dispatch generates significantly 30% smaller dll files compared to Delegate.
  • Symbol Obfus can slightly reduce final dll size in most cases, as obfuscated names are generally shorter than original names.