toStringObfuscator

This obfuscate a string into a number where possible. For example "test" becomes 796469..toString(30)

Created by: hackvertor
Installed 1 times

Viewed: 4

Category: XSS

Created on: Wednesday, September 10, 2025 at 7:18:55 PM

Updated on: Wednesday, September 10, 2025 at 7:20:12 PM

This is a built in tag
Tag arguments
[
   {
      "type": "number",
      "help": "This is the minimum base",
      "defaultValue": "2"
   },
   {
      "type": "number",
      "help": "This is the maximum base",
      "defaultValue": 36
   }
]
Code
class toStringObfuscator {
  encode(target, minBase, maxBase) {
    const s = target.toLowerCase();

    for (let base = minBase; base <= maxBase; base++) {
      if ([...s].some((c) => parseInt(c, 36) >= base || isNaN(parseInt(c, 36))))
        continue;

      let n = 0n;
      for (const ch of s) {
        n = n * BigInt(base) + BigInt(parseInt(ch, 36));
      }

      if (n.toString(base) === s) {
        const literal =
          n <= BigInt(Number.MAX_SAFE_INTEGER) ? n.toString() : `${n}n`;
        return `${literal}..toString(${base})`;
      }
    }
    return null;
  }
}