/

Renamer

Protection ID: rename

This protection renames and confuses the symbols so that the decompiled source code cannot be compiled or read.

This protection is available in the editions:

Developer Startup Enterprise


Parameters

  • Rename public boolean : Renames public members. If your application is a library (dll), applications that use it will not be able to find the functions or public types if they have been renamed. Use this parameter only when it is possible to rename public members. false by default

  • Rename arguments boolean : Rename the function arguments, otherwise the original names will be kept. true by default

  • Rename pdb files boolean : Renames the PDB (Program database) file that stores all the application debug symbols, necessary if you are going to debug the protected application. true by default

  • Flatten namespaces boolean : Remove namespaces to group all types under the same empty namespace and break the original structure. true by default

  • Mode string : The type of characters, generation of symbols and encryption that is used to rename, see here.

  • Force boolean : Forces to rename all symbols, even when Shield recommendations exclude the member. false by default

  • Rename enums boolean : Rename application enums, you should not use this option if you are using nameof(), .ToString() or using enum names to export them. (Since the enums will be obfuscated) false by default

  • Short names boolean : Use short names instead of full names to rename characters. true by default

  • Rename i18n boolean : If your application uses internationalization with i18n and contains Xaml/WPF files, this parameter will take care of obfuscating the names based on the indices of the translation string and will modify the resources for correct operation. true by default

  • Rename Xaml boolean : Renames the application's xaml files as well as the .cs associated with them. true by default


Rules configuration

  • shield.config.json
{
  "protections": {
    "rename": {
      "rename public": true,
      "rename xaml": true,
      "rename arguments": true,
      "rename pdb": true,
      "rename enums": true,
      "rename i18n": true,
      "force": true,
      "remove namespaces": true,
      "short names": true,
      "mode": "default"
    }
  }
}

Modes

  • Default: Generates unique symbols used by official C# functions and uses them to obfuscate application names. We recommend this method because obfuscation cannot be differentiated from an original method. This mode is the only one that by default allows you to decrypt all names with your ByteHide account and recover the original stacktraces of your application.

  • Empty: Replace names with empty strings.

  • Unicode: Replace names with unicode characters.

  • ASCII: Replace names with ascii characters.

  • Letters: Replace names only with letters.

  • Encrypt: This mode encrypts the names with a secret key for your application, allowing anyone with the key to unobfuscate the names. Similar to default mode, but default mode produces better token obfuscation and allows you to automatically decode names just by logging into your bytehide account without having to remember passwords.


Code example

  • Without rename:
internal class Program 
{
    private static void Main(string[] args) {
        var name = getUser();
        Console.WriteLine($"Hello, {name}");
        Console.ReadKey();
    }
}
  • Renamed:
internal class zvsd5gf6kb 
{
    private static void c5ata2sg7i(string[] ku4qwm8u37) {
        var bkn5clw1o4 = 0xfbdflqvw();
        Console.WriteLine($"Hello, {bkn5clw1o4}");
        Console.ReadKey();
    }
}

Exclusions

  • Exclude with attribute

Include this attribute in your source code:

[Obfuscation(Exclude = false, Feature = "-rename")]
  • Exclude from the interface

You can exclude this protection from the methods or classes you want.


Compatibility

FrameworkCompatibilityComments
.NET Core
.NET Framework
.NET (up to 8 version)
.NET Standard
Xamarin IOS
Xamarin Android
Xamarin MacOs
WPF
Blazor
.NET Maui
Unity
ASP
Silverlight
VBa (Visual Basic) or C# (CSharp)
WinRT

Shield is compatible with all versions of .NET, it doesn't matter if you use .NET 2.0, .NET 4.7, .NET Core 2.1 or Xamarin.Forms 5.0, it will adapt automatically according to needs, you don't have to worry about this.

Previous
Control Flow