Typex
Category: Bletchley
Status: Registered and callable in the CyberChef 11.3.0 compatibility inventory.
Input / output: string → string
Background: https://wikipedia.org/wiki/Typex
What it does
Encipher/decipher with the WW2 Typex machine. Typex was originally built by the British Royal Air
Force prior to WW2, and is based on the Enigma machine with some improvements made, including using
five rotors with more stepping points and interchangeable wiring cores. It was used across the
British and Commonwealth militaries. A number of later variants were produced; here we simulate a
WW2 era Mark 22 Typex with plugboards for the reflector and input. Typex rotors were changed
regularly and none are public: a random example set are provided. To configure the reflector
plugboard, enter a string of connected pairs of letters in the reflector box, e.g. AB CD EF
connects A to B, C to D, and E to F (you’ll need to connect every letter). There is also an input
plugboard: unlike Enigma’s plugboard, it’s not restricted to pairs, so it’s entered like a rotor
(without stepping). To create your own rotor, enter the letters that the rotor maps A to Z to, in
order, optionally followed by < then a list of stepping points. 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.
Warning
Historical machine presets currently cover a documented compatibility subset.
Arguments and options
Arguments are positional. Keep their order when using bake() or
Pipeline.then().
Index |
Name |
UI type |
PyChef default |
Accepted values / format |
|---|---|---|---|---|
|
1st (left-hand) rotor |
|
|
|
|
1st rotor reversed |
|
|
|
|
1st rotor ring setting |
|
|
|
|
1st rotor initial value |
|
|
|
|
2nd rotor |
|
|
|
|
2nd rotor reversed |
|
|
|
|
2nd rotor ring setting |
|
|
|
|
2nd rotor initial value |
|
|
|
|
3rd (middle) rotor |
|
|
|
|
3rd rotor reversed |
|
|
|
|
3rd rotor ring setting |
|
|
|
|
3rd rotor initial value |
|
|
|
|
4th (static) rotor |
|
|
|
|
4th rotor reversed |
|
|
|
|
4th rotor ring setting |
|
|
|
|
4th rotor initial value |
|
|
|
|
5th (right-hand, static) rotor |
|
|
|
|
5th rotor reversed |
|
|
|
|
5th rotor ring setting |
|
|
|
|
5th rotor initial value |
|
|
|
|
Reflector |
|
|
|
|
Plugboard |
|
|
|
|
Typex keyboard emulation |
|
|
|
|
Strict output |
|
|
|
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 = ['MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'AN BC FG IE KD LU MH OR TS VZ WQ XJ YP', '', 'None', True]
result = bake(input_value, [{"op": 'Typex', "args": args}])
print(result)
Pipeline example
from pychef import Pipeline
args = ['MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'AN BC FG IE KD LU MH OR TS VZ WQ XJ YP', '', 'None', True]
transform = Pipeline().then('Typex', *args)
result = transform("example")
Dedicated operation module
The registered entry point lives in
pychef.operations.by_operation.typex. Direct calls
receive the input value and a positional argument tuple:
from pychef.operations.by_operation.typex import run
result = run("example", tuple(['MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW', False, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'AN BC FG IE KD LU MH OR TS VZ WQ XJ YP', '', 'None', True]))
- pychef.operations.by_operation.typex.run(value, args)
Run this operation using its shared internal implementation.
- Parameters:
value (str | bytes)
args (Sequence[Any])
- Return type:
str | bytes