termigma 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- termigma-1.0.0/LICENSE +21 -0
- termigma-1.0.0/PKG-INFO +130 -0
- termigma-1.0.0/README.md +102 -0
- termigma-1.0.0/pyproject.toml +44 -0
- termigma-1.0.0/setup.cfg +4 -0
- termigma-1.0.0/src/termigma/__init__.py +6 -0
- termigma-1.0.0/src/termigma/__main__.py +4 -0
- termigma-1.0.0/src/termigma/engine.py +381 -0
- termigma-1.0.0/src/termigma/tui.py +416 -0
- termigma-1.0.0/src/termigma.egg-info/PKG-INFO +130 -0
- termigma-1.0.0/src/termigma.egg-info/SOURCES.txt +14 -0
- termigma-1.0.0/src/termigma.egg-info/dependency_links.txt +1 -0
- termigma-1.0.0/src/termigma.egg-info/entry_points.txt +2 -0
- termigma-1.0.0/src/termigma.egg-info/requires.txt +6 -0
- termigma-1.0.0/src/termigma.egg-info/top_level.txt +1 -0
- termigma-1.0.0/tests/test_engine.py +73 -0
termigma-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rex Ackermann
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
termigma-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: termigma
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: An interactive terminal (TUI) Enigma machine simulator
|
|
5
|
+
Author: Rex Ackermann
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/rexackermann/termigma
|
|
8
|
+
Project-URL: Repository, https://github.com/rexackermann/termigma
|
|
9
|
+
Project-URL: Issues, https://github.com/rexackermann/termigma/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/rexackermann/termigma/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Reference simulator, https://people.physik.hu-berlin.de/~palloks/js/enigma/enigma-u_v262_en.html
|
|
12
|
+
Keywords: enigma,cipher,cryptography,tui,curses,terminal,wwii,history
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: Console :: Curses
|
|
15
|
+
Classifier: Intended Audience :: Education
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Topic :: Security :: Cryptography
|
|
19
|
+
Classifier: Topic :: Games/Entertainment :: Simulation
|
|
20
|
+
Classifier: Topic :: Education
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: windows-curses; platform_system == "Windows"
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# termigma
|
|
30
|
+
|
|
31
|
+
A terminal simulator of the Wehrmacht/Kriegsmarine Enigma machine — rotors,
|
|
32
|
+
plugboard, lampboard, and a live signal-path monitor, all in your terminal.
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
pip install termigma
|
|
36
|
+
termigma
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
No dependencies on Linux/macOS (just the standard library's `curses`). On
|
|
40
|
+
Windows, `pip install termigma` pulls in `windows-curses` automatically.
|
|
41
|
+
|
|
42
|
+
## What it does
|
|
43
|
+
|
|
44
|
+
You type a letter, it lights up on the lampboard, and the **signal path**
|
|
45
|
+
panel shows exactly how it got there: plugboard → entry wheel → through each
|
|
46
|
+
rotor → reflector → back through the rotors → entry wheel → plugboard → lamp.
|
|
47
|
+
The rotors step on every keypress, including the historically correct
|
|
48
|
+
middle-rotor "double step," and there's no undo — same as the real machine.
|
|
49
|
+
|
|
50
|
+
It covers three points in the machine's history:
|
|
51
|
+
|
|
52
|
+
- **Enigma I** (Army/Air Force) — 3 rotors chosen from I–V
|
|
53
|
+
- **M3** (Army/Navy) — 3 rotors chosen from I–VIII
|
|
54
|
+
- **M4 "Shark"** (U-boats) — adds a fourth, non-stepping Beta/Gamma wheel and
|
|
55
|
+
a thin reflector
|
|
56
|
+
|
|
57
|
+
Plus a **commercial-style** mode that demonstrates the real quirk of
|
|
58
|
+
commercial Enigmas: no plugboard, and an entry wheel wired in keyboard
|
|
59
|
+
(QWERTZU) order instead of straight A–Z.
|
|
60
|
+
|
|
61
|
+
## Controls
|
|
62
|
+
|
|
63
|
+
| Key | Does |
|
|
64
|
+
|---|---|
|
|
65
|
+
| `A`–`Z` | Encipher a letter |
|
|
66
|
+
| `Space` | Visual separator (doesn't step the rotors) |
|
|
67
|
+
| `F1` | Help |
|
|
68
|
+
| `F2` | Settings — model preset, ETW mode, plugboard on/off, reflector, movable notches, 4th wheel, all three rotors |
|
|
69
|
+
| `F3` | Plugboard editor |
|
|
70
|
+
| `F5` | Custom rewirable reflector editor (needs Reflector = Custom) |
|
|
71
|
+
| `F4` | Reset to defaults |
|
|
72
|
+
| `Esc` / `Q` | Quit |
|
|
73
|
+
|
|
74
|
+
Terminal needs to be at least 108×34 or it'll ask you to resize.
|
|
75
|
+
|
|
76
|
+
## Why it looks the way it does
|
|
77
|
+
|
|
78
|
+
Real Enigmas didn't have an undo button, a Ctrl-Z, or a way to peek inside
|
|
79
|
+
while it ran. This tries to keep that feel — the rotors always turn, the
|
|
80
|
+
plugboard is genuinely optional depending on which model you pick — while
|
|
81
|
+
also showing you the one thing the real machine couldn't: what's happening
|
|
82
|
+
electrically at every stage, for every keystroke.
|
|
83
|
+
|
|
84
|
+
## Project layout
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
src/termigma/engine.py the machine itself — no curses, fully unit-testable
|
|
88
|
+
src/termigma/tui.py curses rendering and the input loop
|
|
89
|
+
tests/test_engine.py pytest suite (reciprocity checks, stepping, etc.)
|
|
90
|
+
data/wiring_tables.json the historical wiring data, with sourcing notes
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Running from source
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
git clone https://github.com/rexackermann/termigma
|
|
97
|
+
cd termigma
|
|
98
|
+
pip install -e ".[dev]"
|
|
99
|
+
pytest
|
|
100
|
+
termigma
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Accuracy
|
|
104
|
+
|
|
105
|
+
The rotor and reflector wiring (rotors I–VIII, the M4 Beta/Gamma wheels, and
|
|
106
|
+
reflectors B/C plus their thin M4 counterparts) is the widely published
|
|
107
|
+
historical data, checked here against a known reference test vector and a
|
|
108
|
+
set of round-trip (reciprocity) tests — see `tests/test_engine.py`.
|
|
109
|
+
|
|
110
|
+
What's **not** included: exact wiring for the more exotic commercial and
|
|
111
|
+
national variants (Enigma K, Enigma D, Swiss-K, Railway, Tirpitz, Norenigma,
|
|
112
|
+
Sonder-Enigma, the Abwehr G-machines). This project doesn't have confidently
|
|
113
|
+
sourced wiring for those, and a guess dressed up as fact is worse than an
|
|
114
|
+
honest gap. The "commercial-style" preset demonstrates the real no-plugboard
|
|
115
|
+
/ QWERTZU-entry-wheel behavior of commercial machines but reuses the Enigma I
|
|
116
|
+
rotor set rather than true K/D rotors. See `data/wiring_tables.json` for the
|
|
117
|
+
full sourcing note, and cross-check the Crypto Museum's Enigma pages if you
|
|
118
|
+
need one of those specific machines to be byte-exact.
|
|
119
|
+
|
|
120
|
+
## Credits
|
|
121
|
+
|
|
122
|
+
- Inspired by Daniel Palloks' [Universal Enigma](https://people.physik.hu-berlin.de/~palloks/js/enigma/enigma-u_v262_en.html),
|
|
123
|
+
a browser-based simulator covering a much wider range of historical
|
|
124
|
+
Enigma variants than this project attempts.
|
|
125
|
+
- Enigma explainer video: https://www.youtube.com/watch?v=JsBZOcqZerk — for inspiration.
|
|
126
|
+
- Built with help from [Claude](https://claude.ai) (Anthropic).
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT — see [LICENSE](LICENSE).
|
termigma-1.0.0/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# termigma
|
|
2
|
+
|
|
3
|
+
A terminal simulator of the Wehrmacht/Kriegsmarine Enigma machine — rotors,
|
|
4
|
+
plugboard, lampboard, and a live signal-path monitor, all in your terminal.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
pip install termigma
|
|
8
|
+
termigma
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
No dependencies on Linux/macOS (just the standard library's `curses`). On
|
|
12
|
+
Windows, `pip install termigma` pulls in `windows-curses` automatically.
|
|
13
|
+
|
|
14
|
+
## What it does
|
|
15
|
+
|
|
16
|
+
You type a letter, it lights up on the lampboard, and the **signal path**
|
|
17
|
+
panel shows exactly how it got there: plugboard → entry wheel → through each
|
|
18
|
+
rotor → reflector → back through the rotors → entry wheel → plugboard → lamp.
|
|
19
|
+
The rotors step on every keypress, including the historically correct
|
|
20
|
+
middle-rotor "double step," and there's no undo — same as the real machine.
|
|
21
|
+
|
|
22
|
+
It covers three points in the machine's history:
|
|
23
|
+
|
|
24
|
+
- **Enigma I** (Army/Air Force) — 3 rotors chosen from I–V
|
|
25
|
+
- **M3** (Army/Navy) — 3 rotors chosen from I–VIII
|
|
26
|
+
- **M4 "Shark"** (U-boats) — adds a fourth, non-stepping Beta/Gamma wheel and
|
|
27
|
+
a thin reflector
|
|
28
|
+
|
|
29
|
+
Plus a **commercial-style** mode that demonstrates the real quirk of
|
|
30
|
+
commercial Enigmas: no plugboard, and an entry wheel wired in keyboard
|
|
31
|
+
(QWERTZU) order instead of straight A–Z.
|
|
32
|
+
|
|
33
|
+
## Controls
|
|
34
|
+
|
|
35
|
+
| Key | Does |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `A`–`Z` | Encipher a letter |
|
|
38
|
+
| `Space` | Visual separator (doesn't step the rotors) |
|
|
39
|
+
| `F1` | Help |
|
|
40
|
+
| `F2` | Settings — model preset, ETW mode, plugboard on/off, reflector, movable notches, 4th wheel, all three rotors |
|
|
41
|
+
| `F3` | Plugboard editor |
|
|
42
|
+
| `F5` | Custom rewirable reflector editor (needs Reflector = Custom) |
|
|
43
|
+
| `F4` | Reset to defaults |
|
|
44
|
+
| `Esc` / `Q` | Quit |
|
|
45
|
+
|
|
46
|
+
Terminal needs to be at least 108×34 or it'll ask you to resize.
|
|
47
|
+
|
|
48
|
+
## Why it looks the way it does
|
|
49
|
+
|
|
50
|
+
Real Enigmas didn't have an undo button, a Ctrl-Z, or a way to peek inside
|
|
51
|
+
while it ran. This tries to keep that feel — the rotors always turn, the
|
|
52
|
+
plugboard is genuinely optional depending on which model you pick — while
|
|
53
|
+
also showing you the one thing the real machine couldn't: what's happening
|
|
54
|
+
electrically at every stage, for every keystroke.
|
|
55
|
+
|
|
56
|
+
## Project layout
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
src/termigma/engine.py the machine itself — no curses, fully unit-testable
|
|
60
|
+
src/termigma/tui.py curses rendering and the input loop
|
|
61
|
+
tests/test_engine.py pytest suite (reciprocity checks, stepping, etc.)
|
|
62
|
+
data/wiring_tables.json the historical wiring data, with sourcing notes
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Running from source
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
git clone https://github.com/rexackermann/termigma
|
|
69
|
+
cd termigma
|
|
70
|
+
pip install -e ".[dev]"
|
|
71
|
+
pytest
|
|
72
|
+
termigma
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Accuracy
|
|
76
|
+
|
|
77
|
+
The rotor and reflector wiring (rotors I–VIII, the M4 Beta/Gamma wheels, and
|
|
78
|
+
reflectors B/C plus their thin M4 counterparts) is the widely published
|
|
79
|
+
historical data, checked here against a known reference test vector and a
|
|
80
|
+
set of round-trip (reciprocity) tests — see `tests/test_engine.py`.
|
|
81
|
+
|
|
82
|
+
What's **not** included: exact wiring for the more exotic commercial and
|
|
83
|
+
national variants (Enigma K, Enigma D, Swiss-K, Railway, Tirpitz, Norenigma,
|
|
84
|
+
Sonder-Enigma, the Abwehr G-machines). This project doesn't have confidently
|
|
85
|
+
sourced wiring for those, and a guess dressed up as fact is worse than an
|
|
86
|
+
honest gap. The "commercial-style" preset demonstrates the real no-plugboard
|
|
87
|
+
/ QWERTZU-entry-wheel behavior of commercial machines but reuses the Enigma I
|
|
88
|
+
rotor set rather than true K/D rotors. See `data/wiring_tables.json` for the
|
|
89
|
+
full sourcing note, and cross-check the Crypto Museum's Enigma pages if you
|
|
90
|
+
need one of those specific machines to be byte-exact.
|
|
91
|
+
|
|
92
|
+
## Credits
|
|
93
|
+
|
|
94
|
+
- Inspired by Daniel Palloks' [Universal Enigma](https://people.physik.hu-berlin.de/~palloks/js/enigma/enigma-u_v262_en.html),
|
|
95
|
+
a browser-based simulator covering a much wider range of historical
|
|
96
|
+
Enigma variants than this project attempts.
|
|
97
|
+
- Enigma explainer video: https://www.youtube.com/watch?v=JsBZOcqZerk — for inspiration.
|
|
98
|
+
- Built with help from [Claude](https://claude.ai) (Anthropic).
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "termigma"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "An interactive terminal (TUI) Enigma machine simulator"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "Rex Ackermann" }]
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
keywords = ["enigma", "cipher", "cryptography", "tui", "curses", "terminal", "wwii", "history"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 5 - Production/Stable",
|
|
17
|
+
"Environment :: Console :: Curses",
|
|
18
|
+
"Intended Audience :: Education",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Topic :: Security :: Cryptography",
|
|
22
|
+
"Topic :: Games/Entertainment :: Simulation",
|
|
23
|
+
"Topic :: Education",
|
|
24
|
+
]
|
|
25
|
+
dependencies = ["windows-curses; platform_system == 'Windows'"]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = ["pytest>=7"]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
termigma = "termigma.tui:main"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/rexackermann/termigma"
|
|
35
|
+
Repository = "https://github.com/rexackermann/termigma"
|
|
36
|
+
Issues = "https://github.com/rexackermann/termigma/issues"
|
|
37
|
+
Changelog = "https://github.com/rexackermann/termigma/blob/main/CHANGELOG.md"
|
|
38
|
+
"Reference simulator" = "https://people.physik.hu-berlin.de/~palloks/js/enigma/enigma-u_v262_en.html"
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
testpaths = ["tests"]
|
termigma-1.0.0/setup.cfg
ADDED