Constant Encryption

This protection encodes and compresses the constants (numbers, strings and initializers) in the code.

With the ©Smart Native Protection System mode the constants are decrypted with the module verification sum, this system ensures the integrity of the applications.

Developer Startup Enterprise


Parameters

This option is only available in the startup and enterprise editions.

Elements: Determine what type of constants will be encoded.

  • S Strings
  • N Numeric
  • P Primitives
  • I Matrix Initializers

They can all be combined or selected individually.


Modes

Normal: Protect the constants with the checksum of the method and its name.

Ensures the integrity of the code, after this protection you will not be able to modify the code or rename the methods.

© Smart native protection system. Enterprise Protect the constants with the verification sum of the method and its name using native functions that prevent the constants from being debited or decryption methods invoked.

Ensures the integrity of the code, after this protection you will not be able to modify the code or rename the methods.

It may be incompatible with xamarin.


Code example

  • Before:
var key = "https://www.dotnetsafer.com";
string password = "admin";
Console.WriteLine($"key: {key}, password: {password}");
Console.ReadKey();
  • After:
string text = <Module>.get_Condition(VARFLAG_FREPLACEABLE[(94010 < 500724) ? 0 : 537936],unchecked(checked(unchecked(570830 - -870451) + ConcurrentDictionary__2.TargetedPatchingOptOutAttribute);
<Module>.init(text,(Convert.ToInt32( " 1000011100000110110 ", 2) | 250883 * 2) ^ Marshal.SizeOf(typeof(MoveBufferArea)));

string text2 = <Module>.get_Condition((int) array2[((62301 < 630141) ? -255426 : -270726) + (83010 | 172416)],(ConcurrentDictionary__2.add_ReflectionOnlyNamespaceResolve * checked((array[6] >>
(6 | 4)) - unchecked(833425 + -830673) * Convert.ToInt32( " 334 ", 8)));
<Module>.init(text2,((18665 % 7466 > Convert.ToInt32( " fffd0bb9 ", 16)) ? 1 : 0) == 0 / 2133));

Console.WriteLine($" key: {text}, password: {text2} ");
Console.ReadKey();

Exclusions

  • Exclude with attribute

Include this attribute in your source code:

[Obfuscation(Exclude = true, Feature = "Constants")]
  • Exclude from the interface

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


Compatibility

Previous
Constant Disintegration