Number To String

Potency Low
Resilience Low
Cost Low
Tags: numbers, strings, obfuscation

Description

Number to String replaces the literal numbers (decimals, hexadecimals, octals, exponent notation) with a string representation that returns the same number value at run-time.

Code Annotation Example

// @jscrambler enable numberToString

Example

The following example contains a literal (integer) number:

user.phoneNumber = 555666777;

The result is an expression that returns the same number value using type coercion. The transformation produces random results so the following example is just a possible output:

user.phoneNumber = '555666777'-+[];

Using this transformation creates more targets for string obfuscation transformations.

Option Types

Name Required Default Value Description
freq No 0.8 Probability of applying the transformation when the node allows for the transformation to happen.
min No N/A Minimum number of times the transformation is applied to each JavaScript file. This number may still not be reached if there are not enough candidates to apply the transformation to.
max No -1 Maximum number of times the transformation is applied to each JavaScript file.

Browser Compatibility

Browser Compatible Versions Tested Versions Notes
Chrome 50+ 50+
Firefox 40+ 40+
Internet Explorer 8+ 8+
Microsoft Edge 18+ 18+
Safari 9.1+ 9.1+

API Parameters

Example:

{
  "keys": {
    "accessKey": "XXXXXX",
    "secretKey": "YYYYYY"
  },
  "applicationId": "ZZZZZZ",
  "params": [
    {
      "name": "numberToString",
      "options": {}
    }
  ]
}