Dotfuscator User's Guide
Class Renaming Options

Full Class Renaming

The default methodology renames the class and namespace name to a new, smaller name. The idea behind this is quite simple. Our example becomes:

Original Name New Name
Preemptive.Application.Main a
Preemptive.Application.LoadData b
Preemptive.Tools.BinaryTree c
Preemptive.Tools.LinkedList d
Note: All classes are now in the <global> namespace.

Keepnamespace Option

This methodology is excellent as a way to hide the names of your classes while maintaining namespace hierarchy. You give up some size reduction and obfuscation potential, but preserve your namespace names. This is useful for libraries that may be linked to obfuscated code, or for applications that use already obfuscated code. An example of this type of renaming is:

Original Name New Name
Preemptive.Application.Main Preemptive.Application.a
Preemptive.Application.LoadData Preemptive.Application.b
Preemptive.Tools.BinaryTree Preemptive.Tools.a
Preemptive.Tools.LinkedList Preemptive.Tools.b
Note: Keepnamespace and Keephierarchy are mutually exclusive options.

Keephierarchy Option

This option tells Dotfuscator to preserve the namespace hierarchy, while renaming the namespace and class names. For example:

Original Name New Name
Preemptive.Application.Main a.a.a
Preemptive.Application.LoadData a.a.b
Preemptive.Tools.BinaryTree a.b.a
Preemptive.Tools.LinkedList a.b.b

Renaming Prefixes

In some cases it is desirable to have unique top level type names across assemblies, even if those type names are not visible outside their defining assemblies. This is done by running all assemblies through Dotfuscator at the same time. As this approach is not always feasible, Dotfuscator provides a way to enforce uniqueness even across runs, using a renaming prefix.

Renaming prefixes are appended to top level renamed type names. You can specify your own renaming prefix that will be used for all assemblies in a given Dotfuscator run, or you can allow Dotfuscator to pick a prefix for you, based on the type's module name.

One interesting application of this feature is namespace induction. By defining a custom renaming prefix that ends with a ".", (e.g. "MY_PREFIX."), you can place your obfuscated types in a custom defined, common namespace.

Examples:

Original Name Prefix Type Renaming New Name
Application.Main [default] default MyApplicationa
Application.LoadData myprefix default myprefixa
Tools.BinaryTree myprefix keephierarchy a.myprefixa
Tools.LinkedList myprefix keepnamespace Tools.myprefixa
Tools.Proxy mynamespace. keepnamespace Tools.mynamespace.a

There are three ways you can configure renaming prefixes for your project:

Prefix On
Copy Code
Dotfuscator /p=prefix=MY_PREFIX /pref:on [other options...]
Define a Custom Prefix
Copy Code
  <propertylist>
     <!-- defining prefix here tells the renamer to use the value as the
        renaming prefix, if renaming prefix is enabled -->
     <property name="prefix" value="MY_PREFIX"/>
  </propertylist>
  <renaming>
     <!-- this turns on the renaming prefix feature -->
     <option>prefix</option>
  ...
  </renaming>

     

     


    © 2016 PreEmptive Solutions, LLC. All Rights Reserved.

    www.preemptive.com