Obfuscated
One byte and five commands, buried under four layers of encoding.
None1 · Turing complete: no · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
None1 made Obfuscated after Malbolge, and the specification says its goal is to make you suffer. The machine underneath is tiny. The suffering is in the writing, which takes five steps, and the specification admits it did all of them in Python.
Read the story
- Write the commands, one a line.
- Pad each line with a space and random characters to exactly 30 characters.
- Encode the whole program in base64.
- Swap each base64 character through a fixed cipher.
- Write each character's code as seven binary digits, with
Ofor 1.
So OUT 65 grows into 280 digits of O and 0.
The machine
One byte register that starts at 0 and wraps at 256.
| Command | Does |
|---|---|
IN | Read a byte, 0 at the end of the input |
OUT x | Print the character x |
OUT * | Print the register |
ADD x | Add x to the register |
JMP x | Go to line x, counted from 0, when the register is not 0 |
With one byte and a fixed program it is a finite state machine. The specification gives an interpreter in JavaScript. As printed it lowercases each line and then compares with capitals, so it would run nothing; this implementation compares without case, as the specification says commands are.
Example
The specification's own example.
The specification's own example. It decodes to OUT 65 and some padding.
The truth machine decodes to six lines. It reads a byte, adds 208 and then 48 to print it, adds 208 again to get 0 or 1, and jumps back to the print while that is 1.
The Hello World decodes to twelve OUT lines and prints Hello World!. Its cat reads and prints until the input ends, and then also prints the 0 byte that the end of the input gives.
Patterns it teaches
- Hostile design: the language is easy, the writing is not.
- Encoding tricks: base64, a cipher and binary on top of each other.
Further
See also
Also in Hostile
Write your own in Run Convert a program from Obfuscated
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: obfuscated.
Command line
shib run obfuscated -e '0OO00O0O000O00OO00OOOOO00O00O0OO0O0O0OO000O0O0OOOO000O00O0OO0O0O000OOOOO00OOOOO00OOOOOOO00O0OO0OOOO00OOOOO0O000O0O0O0OOO000OOOO00OO00OO00OO00OO0O00O00OO00OO00OOOOOOO00OO00000OO00000OO00O00OO0O0OOOOO0O00OOOO0000OO00O00OO0000O0O0OOOOO00OOOOO0OO0O0OO00OO00OO0O00OOO0000OOO00O0OOO0000'shib manual obfuscatedSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/obfuscated.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org