encodedWordCopy

Encodes and decode encoded word.

Created by: t068y
Installed 1 times

Viewed: 13

Category: SQLi

Created on: Friday, August 15, 2025 at 12:26:14 PM

Updated on: Friday, August 15, 2025 at 12:26:14 PM

Tag arguments
[]
Code
class encodedWord {
  encode(input) {
    return input
      .split("")
      .map((chr) => "=" + chr.codePointAt().toString(16).padStart(2, "0"))
      .join("");
  }

  decode(input) {
    return input.replaceAll(/=[a-fA-F0-9]{2}/gi, function (hex) {
      return String.fromCodePoint(parseInt(hex.replaceAll("=", ""), 16));
    });
  }

  matches(input) {
    return /^(=[a-fA-F0-9]{2})+/.exec(input);
  }
}