Custom String Encodings

Custom String Encodings allows you to define your own string encoding/decoding functions.

Option name: "customStringEncodings"

Option values: true/false/0-1


Input / Output

This example showcases how Custom String Encodings transforms the code. Try it out by changing the input code and see changes apply in real-time.

Input.js

Output.js


Custom String Encoding API

The Custom String Encoding API allows you to define your own string encoding/decoding functions. These encodings will be randomly inserted throughout the code.

Options.js


The properties of the type Custom String Encoding are:

Property Type Description
code string Template decoder code that must contain '{fnName}'.
encode Function Encoding algorithm.
decode? Function Decoding algorithm. (Optional)
identity? string Distinguishes multiple encodings. (Optional)
  • The template code should contain the string {fnName}, which the obfuscator can interpolate with the function name.
  • The functions encode and decode have the type: (strValue: string) => string.
  • The function decode is optional. If provided, the obfuscator will validate each string to ensure it can be decoded. If the string cannot be decoded, the obfuscator will ignore the string.

Advanced Randomized Encoding

The following example implements a custom Base64 encoding that uses a shuffled charset to encode and decode strings.

  • This encoding algorithm is instantiated multiple times, each with a different shuffled charset. This makes it difficult to reverse-engineer the encoding algorithm.

Options.js


Usage Example

The provided code example will obfuscate the file input.js and write the output to a file named output.js.

Usage Example


Enabled In