esolang

Memory GAP

The program is a list of MD5 hashes. To run it, the interpreter has to crack every one.

Conor O'Brien · Turing complete: unknown · ●●● hard

Tested with 5 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hello, World!

The idea

Memory GAP is a stack language by Conor O'Brien, made to be awkward on purpose. Its commands are short English words like out, dup and open, but a program never contains the words. It contains their MD5 hashes, 32 hex digits each. The interpreter turns each hash back into a word by brute force. It tries a, b, … z, aa, … and, in between, every printable string from a space upwards, until one hashes right.

Read the story

So the cost of a program is in its spelling. A command of three lowercase letters is found in about ten thousand tries. A literal like Wor takes half a million, because the printable search only reaches capital letters after every shorter string.

The machine

WordDoes
any non-commandPush the word as a string
out in #Print a popped value; push a line of input; push a number from a line
dup pop swap bubStack shuffles; bub pops n and rotates the top n
nil len sizePush 0; push the depth; pop a string and push its length
add neg rep charAdd or join; negate; n ones as a string; a code as a character
get btwnIndex into a value; 1 if lo ≤ n ≤ hi
open … shutLoop while the top is not nil, 0 or empty; neither pops

Example

The first hashes !, ld, Wor, , , llo, He, open, out and shut.
Expected: 42
Expected: cat me

The first hashes !, ld, Wor, , , llo, He, open, out and shut. The pieces go on the stack in reverse, and the loop prints until it reaches the empty bottom. The second is # # add out, and the third is a cat, in open out in shut.

This implementation stops the search after every printable string of up to three characters, 866,495 rounds in all, and counts a thousand tries as one step. The original would go on searching for minutes.

Further

Ideas it shows

Also in Hostile

Write your own in Run Convert a program from Memory GAP

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: memory-gap.

Command line

shib run memory-gap -e '01abfc750a0c942167651c40d088531d a87deb01c5f539e6bda34829c8ef2368 c68271a63ddbc431c307beb7d2918275' --input '65
'
shib manual memory-gap

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/memory-gap.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language