JSfuck: write any JavaScript with 6 Characters
Yes, only []()!+
JSFuck is an esoteric programming language with a very limited set of characters: (,), [, ], +, !.
The name is derived from Brainfuck, but the only similarity to Brainfuck is having a minimalistic alphabet.
The challenge in JSFuck lies in fact in recreating the full set of JavaScript functions using only these six characters, which is made possible by two properties of JavaScript:
- It is a weakly typed programming language
- It allows the evaluation of any expression as any type.
JSFuck was originally developed by Martin Kleppe as a challenge, but JSFuck is a valid JavaScript code, and JSFuck programs can be run in any web browser or engine that interprets JavaScript.
Then a potential use lies in code obfuscation to hide malicious code in compromized websites or in XSS attacks.
Here an example of the simple “alert(1)” translated into JSFuck:
https://jsfiddle.net/LjLsr60z/
More information about conversion process can be read on the GitHub repository:
[embed]https://github.com/aemkei/jsfuck[/embed]
JSFuck is an esoteric and educational programming style based on the atomic parts of JavaScript. It uses only six different characters to write and execute code.
It does not depend on a browser, so you can even run it on Node.js.
Lastly, Martin Kleppe has also developed a tool to automate the conversion:
[embed]https://github.com/aemkei/jsfuck[/embed]