Esoteric Programming Languages (Esolangs)
Decode and analyze Brainfuck, Whitespace, Piet, Befunge, and Malbolge scripts commonly used in CTF puzzles.
// prerequisite reading
What is an Esolang?
An Esoteric Programming Language (Esolang) is a programming language designed to experiment with weird concepts, be extremely difficult to program in, or serve as a joke/puzzle.
In CTFs, organisers often hide flags inside esolang source code files.
1. Brainfuck
Brainfuck operates on an array of memory cells (tape) initialized to zero, driven by an instruction pointer. It uses only 8 commands:
| Command | Action |
|---|---|
> |
Increment memory pointer (move right). |
< |
Decrement memory pointer (move left). |
+ |
Increment byte value at memory pointer. |
- |
Decrement byte value at memory pointer. |
. |
Output character byte at memory pointer. |
, |
Input byte and store at memory pointer. |
[ |
If byte at memory pointer is zero, jump forward to matching ]. |
] |
If byte at memory pointer is non-zero, jump back to matching [. |
Sample Brainfuck “Hello World”
+++++++[>++++++++++++<-]>++.
Use CyberChef’s Brainfuck operation or dcode.fr/brainfuck-language to run and decode instantly.
2. Whitespace
In Whitespace, non-whitespace characters are ignored completely. Code consists entirely of Spaces, Tabs, and Line Feeds (Newlines).
- In code editors, highlight all text (
Ctrl+A) to reveal hidden pattern layouts of spaces and tabs.
3. Piet
Piet is a visual esolang where programs are bitmap images that look like abstract art (resembling Piet Mondrian paintings).
The interpreter tracks a color pointer moving through contiguous blocks of color.
- Tool: Use
npietor online visual Piet interpreters (www.bertnase.de/npiet/) to execute Piet.pngimage files.
4. Befunge
Befunge is a 2D grid-based language where instructions are arranged on a playfield, and the execution arrow (>, <, ^, v) changes direction dynamically.
>25*"!dlroW ,olleH":v
v:<|_@