0

EnigmaDecrypt

Fresh

Enigma Decrypt is an environment where agents decrypt WWII-era Enigma-encoded German military messages. Each task presents an intercepted ciphertext encrypted with a historically accurate Wehrmacht Enigma I machine (3-rotor, plugboard configuration). The agent is given partial…

Type
RL Env
Runtime
ORS
License
unknown
Size
10500 tasks
Published
Mar 2026
Updated
Mar 2026

Cite

Notes

Only stored in your browser.

Enigma Decrypt

OpenReward Environment

Description

Enigma Decrypt is an environment for computational cryptanalysis. Each task is an intercepted German military radio message encrypted on a historically accurate Enigma I (three rotors from I-V, reflector UKW-B, plugboard). The agent works in a Python sandbox and must recover the full key with its own code: a known-plaintext (crib) attack at the lower levels, a ciphertext-only statistical attack at the upper ones. It then submits the key.

The Enigma simulator is verified against the 1930 German military instruction manual test vector and for reciprocity, no self-encryption and the double-stepping anomaly.

Capabilities

  • Implementing and optimising a cipher machine simulation (vectorised search over rotor settings)
  • Known-plaintext attacks: menus, loops and bombe-style search from cribs
  • Ciphertext-only attacks: index of coincidence and n-gram scoring, plugboard hill-climbing
  • Using language statistics and recognising partially correct German plaintext
  • Managing long-running computations within time limits

Compute Requirements

Each session gets a sandbox (2 CPUs, 4 GB RAM, no network) with Python, numpy and scipy (generalreasoning/python-ds:3.12-tools). Commands time out after 600 seconds by default and 900 seconds at most. Longer searches run as detached jobs (setsid -f cmd > log 2>&1 < /dev/null), which the prompt explains; a plain cmd & would block the call until its time limit.

License

MIT

Tasks

Tasks are generated procedurally: each task id L<level>-<seed> deterministically yields a fresh plaintext, key, ciphertext and (for crib levels) cribs. The train split has 10,000 tasks, weighted towards the levels that give the most learning signal: 1,500 at level 1, 3,000 each at levels 2 and 3, 1,500 at level 4 and 1,000 at level 5 (seeds 0 to count−1). Sampling the split uniformly therefore gives levels 1-5 15%, 30%, 30%, 15% and 10% of episodes. The test split has seeds 1,000,000-1,000,099 for each level (500 tasks).

LevelAttackKnownMessage lengthPlugboard pairsCribsSandbox kit
1known plaintextrotor order, reflector80-12061 crib of 14-16 letters whose menu has at least 1 loop; the middle rotor does not step within itreference simulator, German text sample
2known plaintextreflector100-150102 cribs of 12-16 letters with at least 3 loops in total; the left rotor does not move between themreference simulator, German text sample
3known plaintextreflector100-15010as level 2machine specification only
4ciphertext onlyreflector400-5005-6none; the left rotor does not move during the messagereference simulator, German text sample
5ciphertext onlyreflector350-4506none; the left rotor does not move during the messagemachine specification only

The number of plugboard pairs is always stated. Ring settings and start positions are always unknown.

The sandbox workspace (/workspace) holds ciphertext.txt and task.md (known settings, cribs, plaintext conventions). Levels with a kit add enigma_reference.py, a correct but slow simulator with a command-line interface, and german_sample.txt, about 80 KB of messages in the same style for language statistics. Levels without a kit include the full machine specification (wirings, turnover letters, stepping rules) and test vectors in task.md.

Reward Structure

This is a verifiable reward environment. No LLM grader is used.

The agent submits a key. The server decrypts the ciphertext with it and counts the letters that match the hidden plaintext, over the positions not covered by cribs. With $n$ such positions and accuracy $a$:

$$\text{reward} = \text{clip}\left(\frac{a - c}{1 - c}, 0, 1\right), \quad c = p + 2\sqrt{\frac{p(1-p)}{n}}, \quad p = \frac{1}{25}$$

A wrong key's output letter is never the ciphertext letter (Enigma has no fixed points) and otherwise uniform, as is the plaintext letter, so random keys match with probability $1/25$; the margin of two standard deviations makes random keys score 0. A key that decrypts the whole message correctly scores 1, including equivalent keys that differ only in settings with no effect on the decryption. Partly correct keys earn partial credit: for example the right rotor settings with some of the plugboard pairs.

The first valid submission is scored and ends the episode. A malformed key is rejected with an error and does not end the episode. A submission after the episode has ended scores -0.1.

Data

Plaintexts are generated by a template grammar of WWII-style German military messages (weather reports, U-boat reports, orders, situation reports, logistics) in the conventions of the period: uppercase A-Z only, X for a full stop, ZZ for a comma, Q for CH, umlauts as AE/OE/UE and numbers spelled out (ZWO for 2). The German text sample in the kit is drawn from a separate seed and shares no 40-letter passage with any task plaintext. All data is synthetic.

Tools

ToolDescription
bash, read, write, edit, multi_edit, glob, grep, ls, todo_writeSandbox CLI tools, rooted at /workspace
submit_keySubmit the key (rotor_order, reflector, ring_settings, initial_positions, plugboard); the first valid key is scored and ends the episode

Time Horizon

Multi-turn. The agent writes and runs search code over many tool calls; ciphertext-only levels need searches lasting minutes to hours on two CPUs.

Environment Difficulty

Level 1 is solvable with a simple search over start positions and ring settings guided by the crib. Levels 2 and 3 need a bombe-style menu search or crib-driven hill-climbing over all 60 rotor orders. Levels 4 and 5 need a full ciphertext-only attack (index-of-coincidence search over rotor settings followed by plugboard hill-climbing); level 5 adds a shorter message and no kit. With more plugboard pairs or shorter messages the index of coincidence at the true rotor setting no longer stands out from the best wrong settings, so ciphertext-only levels keep to at most six pairs and at least 350 letters.

Other Environment Requirements

An OpenReward API key is required (secrets["api_key"]) to create the sandbox.

Safety

Agents interact only with a simulated historical cipher machine and synthetic messages. The cryptographic techniques involved are of historical interest and have no bearing on modern ciphers.

Citations

@dataset{GREnigmaDecrypt,
  author    = {General Reasoning Inc. Team},
  title     = {Enigma Decrypt},
  year      = {2026},
  publisher = {OpenReward},
  url       = {https://openreward.ai/GeneralReasoning/enigma-decrypt}
}