Bombe

Category: Bletchley

Status: Registered and callable in the CyberChef 11.3.0 compatibility inventory.

Input / output: string → JSON

Background: https://wikipedia.org/wiki/Bombe

What it does

Emulation of the Bombe machine used at Bletchley Park to attack Enigma, based on work by Polish and British cryptanalysts. To run this you need to have a ‘crib’, which is some known plaintext for a chunk of the target ciphertext, and know the rotors used. (See the ‘Bombe (multiple runs)’ operation if you don’t know the rotors.) The machine will suggest possible configurations of the Enigma. Each suggestion has the rotor start positions (left to right) and known plugboard pairs. Choosing a crib: First, note that Enigma cannot encrypt a letter to itself, which allows you to rule out some positions for possible cribs. Secondly, the Bombe does not simulate the Enigma’s middle rotor stepping. The longer your crib, the more likely a step happened within it, which will prevent the attack working. However, other than that, longer cribs are generally better. The attack produces a ‘menu’ which maps ciphertext letters to plaintext, and the goal is to produce ‘loops’: for example, with ciphertext ABC and crib CAB, we have the mappings A<->C, B<->A, and C<->B, which produces a loop A-B-C-A. The more loops, the better the crib. The operation will output this: if your menu has too few loops or is too short, a large number of incorrect outputs will usually be produced. Try a different crib. If the menu seems good but the right answer isn’t produced, your crib may be wrong, or you may have overlapped the middle rotor stepping - try a different crib. Output is not sufficient to fully decrypt the data. You will have to recover the rest of the plugboard settings by inspection. And the ring position is not taken into account: this affects when the middle rotor steps. If your output is correct for a bit, and then goes wrong, adjust the ring and start position on the right-hand rotor together until the output improves. If necessary, repeat for the middle rotor. By default this operation runs the checking machine, a manual process to verify the quality of Bombe stops, on each stop, discarding stops which fail. If you want to see how many times the hardware actually stops for a given input, disable the checking machine. More detailed descriptions of the Enigma, Typex and Bombe operations can be found here.

Note

Status here means the operation name is implemented and callable. It does not by itself promise byte-for-byte parity for every upstream option. See Compatibility and current status for the verified scope and known boundaries.

Arguments and options

Arguments are positional. Keep their order when using bake() or Pipeline.then().

Index

Name

UI type

PyChef default

Accepted values / format

0

Model

argSelector

'3-rotor'

'3-rotor', '4-rotor'

1

Left-most (4th) rotor

editableOption

'LEYJVCNIXWPBQMDRTAKZGFUHOS'

'LEYJVCNIXWPBQMDRTAKZGFUHOS', 'FSOKANUERHMBTIYCWLQPZXVGJD'

2

Left-hand rotor

editableOption

'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R'

'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'AJDKSIRUXBLHWTMCQGZNPYFVOE<F', 'BDFHJLCPRTXVZNYEIWGAKMUSQO<W', 'ESOVPZJAYQUIRHXLNFTGKDCMWB<K', 'VZBRGITYUPSDNHLXAWMJQOFECK<A', 'JPGVOUMFYQBENHZRDKASXLICTW<AN', 'NZJHGRCXMYSWBOUFAIVLPEKQDT<AN', 'FKQHTLXOCBJSPDZRAMEWNIUYGV<AN'

3

Middle rotor

editableOption

'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R'

'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'AJDKSIRUXBLHWTMCQGZNPYFVOE<F', 'BDFHJLCPRTXVZNYEIWGAKMUSQO<W', 'ESOVPZJAYQUIRHXLNFTGKDCMWB<K', 'VZBRGITYUPSDNHLXAWMJQOFECK<A', 'JPGVOUMFYQBENHZRDKASXLICTW<AN', 'NZJHGRCXMYSWBOUFAIVLPEKQDT<AN', 'FKQHTLXOCBJSPDZRAMEWNIUYGV<AN'

4

Right-hand rotor

editableOption

'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R'

'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'AJDKSIRUXBLHWTMCQGZNPYFVOE<F', 'BDFHJLCPRTXVZNYEIWGAKMUSQO<W', 'ESOVPZJAYQUIRHXLNFTGKDCMWB<K', 'VZBRGITYUPSDNHLXAWMJQOFECK<A', 'JPGVOUMFYQBENHZRDKASXLICTW<AN', 'NZJHGRCXMYSWBOUFAIVLPEKQDT<AN', 'FKQHTLXOCBJSPDZRAMEWNIUYGV<AN'

5

Reflector

editableOption

'AY BR CU DH EQ FS GL IP JX KN MO TZ VW'

'AY BR CU DH EQ FS GL IP JX KN MO TZ VW', 'AF BV CP DJ EI GO HY KR LZ MX NW TQ SU', 'AE BN CK DQ FU GY HW IJ LO MP RX SZ TV', 'AR BD CO EJ FN GT HK IV LM PW QZ SX UY'

6

Crib

string

''

''

7

Crib offset

number

0

A Python integer or floating-point value

8

Use checking machine

boolean

True

True or False

Recipe template

Important

This is a call template built from the documented defaults. Replace placeholder values such as empty keys, paths, patterns, or lookup data before running it.

from pychef import bake

input_value = "example"
args = ['3-rotor', 'LEYJVCNIXWPBQMDRTAKZGFUHOS', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'AY BR CU DH EQ FS GL IP JX KN MO TZ VW', '', 0, True]
result = bake(input_value, [{"op": 'Bombe', "args": args}])
print(result)

Pipeline example

from pychef import Pipeline

args = ['3-rotor', 'LEYJVCNIXWPBQMDRTAKZGFUHOS', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'AY BR CU DH EQ FS GL IP JX KN MO TZ VW', '', 0, True]
transform = Pipeline().then('Bombe', *args)
result = transform("example")

Direct call

pychef.ops.run_operation runs any registered operation as a plain function, under the active ExecutionPolicy (safe defaults, no network):

from pychef.ops import run_operation

args = ['3-rotor', 'LEYJVCNIXWPBQMDRTAKZGFUHOS', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'AY BR CU DH EQ FS GL IP JX KN MO TZ VW', '', 0, True]
result = run_operation('Bombe', "example", args=args)

Common operations also have typed helpers in Direct operations.

Low-level operation module

Warning

The module below is an internal implementation detail. It applies no execution policy, resource limits, or error sanitization; prefer bake(), Pipeline, or pychef.ops for application code.

The registered entry point lives in pychef.operations.by_operation.bombe. Direct calls receive the input value and a positional argument tuple:

from pychef.operations.by_operation.bombe import run

result = run("example", tuple(['3-rotor', 'LEYJVCNIXWPBQMDRTAKZGFUHOS', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'EKMFLGDQVZNTOWYHXUSPAIBRCJ<R', 'AY BR CU DH EQ FS GL IP JX KN MO TZ VW', '', 0, True]))
pychef.operations.by_operation.bombe.run(value, args)

Run this operation using its shared internal implementation.

Parameters:
  • value (str | bytes)

  • args (Sequence[Any])

Return type:

str | bytes