transliterate.js

Translate any JavaScript code to foreign writing systems.

This tool will convert your input into an obfuscated script that uses symbols of foreign alphabets such as Kanji (離壱弐), Karian (𐊣𐊦𐊧) or even Hieroglyphs (𓅂𓂀𓁄).

Your Code:

Symbols:

Presets:

Output

// obfuscated output

↑ Edit the alphabet and the code above.

Run this code


Type in a list of 9 up to 26 unique symbols in the input above. They are used to convert the provided source to cryptic but valid JavaScript that you can execute without any extra code.

* Created by Martin Kleppe aka @aemkei.
* More hacks and creative coding at aem1k.com.

Hint: You can also share the URL which updates while typing.


Background

The provided code is converted to an octal code sequence, where numbers 0..8 are assigned to variables. The variable names are then replaced with one of the provided symbols.

To execute the scripts, we grab individual characters from basic JavaScript values and objects. They are combined to access the Function constructor which can evaluate the encoded script.

Script:

// variables for digits 0..9
_0 = +![];        // 0
_1 = +!_0;        // 1
_2 = _1 + _1;     // 2
_3 = _2 + _1;     // 3
_4 = _2 * _2;     // 4
_5 = _3 + _2;     // 5
_6 = _2 * _3;     // 6
_7 = _4 + _3;     // 7

// variables for strings from basic types 
[
  BACKSLASH,      // '\\'
  QUOTE,          // '""
  T,R,U,,         // 'true'
  ,,,S,,          // 'false'
  ,N,,,,I,,,,     // 'undefined'
  ,O,,J,E,C       // '[object Object]'
] = 
  (X='\\"') +     // "\
  !!X +           // true
  !X +            // false
  X.X +           // undefined
  {}              // {}

// Function constructor
CONSTRUCTOR = C+O+N+S+T+R+U+C+T+O+R,
CONSTRUCTOR = CONSTRUCTOR
  [CONSTRUCTOR]
  [CONSTRUCTOR],

// shortcut to "join" and "return "
JOIN = J + O + I + N,
RETURN = R + E + T + U + R + N + ' ';

// evaluate encoded script
CONSTRUCTOR(
  CONSTRUCTOR(
    RETURN + QUOTE + CONSTRUCTOR(
      RETURN + [
        ..."ENOCODED_SCRIPT"
      ][JOIN]("+")
    )()+ QUOTE
  )()
)()
        

20XX - Martin Kleppe