Skip to content

Charsets

Charsets are a set of characters that will be used for obfuscation.

Valid Charset

A valid charset must be an object that contains key-value pairs where:

  • The key is the character to be replaced. It must be a single alphabet character (a-z, A-Z).
  • The value is an array of characters that will replace the key. It must be an array of any single character other than the control characters and private use characters.

Below is an example of a valid charset in JSON and JavaScript object.

  • JSON

    {
    "a": ["@", "4"],
    "e": ["3"],
    "i": ["1", "!"],
    "o": ["0"],
    "s": ["5", "$"],
    "t": ["7"]
    }
  • JavaScript

    {
    a: ['@', '4'],
    e: ['3'],
    i: ['1', '!'],
    o: ['0'],
    s: ['5', '$'],
    t: ['7'],
    }

See the built-in charsets for more examples.

Built-in Charsets

Below is the built-in charsets available. You can use the name of the charset as a string in the charSets option.

Charset NameBlock NameBlock Range
latinBasic Latin\u0000 - \u007f
latin-1Latin-1 Supplement\u0080 - \u00ff
latin-ext-aLatin Extended-A\u0100 - \u017f
latin-ext-bLatin Extended-B\u0180 - \u024f

See the details of each charsets in the package repository.