enigmapython 1.2.2__tar.gz → 1.3.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.
- {enigmapython-1.2.2 → enigmapython-1.3.0}/PKG-INFO +4 -2
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Enigma.py +1 -1
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Etw.py +4 -1
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Plugboard.py +4 -1
- enigmapython-1.3.0/enigmapython/Reflector.py +10 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Rotor.py +7 -2
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Scrambler.py +6 -1
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/XRay.py +12 -7
- enigmapython-1.3.0/enigmapython/__init__.py +1 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython.egg-info/PKG-INFO +4 -2
- {enigmapython-1.2.2 → enigmapython-1.3.0}/setup.py +1 -1
- enigmapython-1.2.2/enigmapython/Reflector.py +0 -4
- enigmapython-1.2.2/enigmapython/__init__.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Alphabets.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Clonable.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133Etw.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133RotorI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133RotorII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133RotorIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaD.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDEtw_JWULCM.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDEtw_QWERTZ.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDRotorI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDRotorII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDRotorIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorway.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorIV.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorV.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorIV.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorV.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaISonder.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaISonderRotorI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaISonderRotorII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaISonderRotorIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorIV.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorV.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorVI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorVII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorVIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorBeta.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorGamma.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorIV.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorV.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorVI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorVII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorVIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZ.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZEtw.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZRotorI.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZRotorII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZRotorIII.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EtwPassthrough.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Journaled.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Observable.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Observer.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/PlugboardPassthrough.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorDUKW.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorNorwayUKW.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorSonderUKW.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWA.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWB.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWBThin.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWC.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWCThin.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKW_EnigmaB_A133.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorZUKW.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/RotatingReflector.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Swappable.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/SwappablePlugboard.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Utils.py +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython.egg-info/SOURCES.txt +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython.egg-info/dependency_links.txt +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython.egg-info/top_level.txt +0 -0
- {enigmapython-1.2.2 → enigmapython-1.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: enigmapython
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: A simple yet faithful library to emulate different Enigma machines models using Python
|
|
5
5
|
Home-page: https://github.com/denismaggior8/enigma-python
|
|
6
6
|
Author: Denis Maggiorotto
|
|
@@ -190,4 +190,6 @@ In the case you leveraged **enigmapython** API in a project, either public or no
|
|
|
190
190
|
|
|
191
191
|
for having helped me testing the correctness of the generated ciphertexts
|
|
192
192
|
|
|
193
|
+
## Support
|
|
193
194
|
|
|
195
|
+
Found it useful/funny/educational? Please consider to [](https://www.buymeacoffee.com/denismaggior8)
|
|
@@ -107,7 +107,7 @@ class Enigma(Observer,Journaled,Clonable):
|
|
|
107
107
|
# Engaging the enigma double step issue, only if the next rotor position is in its notch indexe/s
|
|
108
108
|
if self.rotors[self.rotors.index(observable)+1].position in self.rotors[self.rotors.index(observable)+1].notch_indexes:
|
|
109
109
|
self.rotors[self.rotors.index(observable)+1].double_step_triggered = True
|
|
110
|
-
# If the rotor is the last one in the list, but the machine has a rotating reflector, increment
|
|
110
|
+
# If the rotor is the last one in the list, but the machine has a rotating reflector, increment its position by 1
|
|
111
111
|
if observable in self.rotors and self.rotors.index(observable) == len(self.rotors)-1 and isinstance(self.reflector, RotatingReflector):
|
|
112
112
|
self.reflector.increment_position()
|
|
113
113
|
logging.debug("Reflector has been incremented by 1 position")
|
|
@@ -40,8 +40,13 @@ class Rotor(Scrambler,Observable):
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def __str__(self):
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
str = Scrambler.__str__(self)
|
|
44
|
+
str += "\n"
|
|
45
|
+
# Slice the wiring, in order to left-rotate it according to the position
|
|
46
|
+
n = self.position % len(self.wiring)
|
|
47
|
+
str += self.wiring[n:] + self.wiring[:n]
|
|
48
|
+
return str
|
|
49
|
+
|
|
45
50
|
|
|
46
51
|
def __eq__(self, __value: object) -> bool:
|
|
47
52
|
return id(self) == id(object)
|
|
@@ -60,4 +60,9 @@ class Scrambler(Journaled):
|
|
|
60
60
|
return alphabet_list[(i + shift) % len(alphabet_list)]
|
|
61
61
|
|
|
62
62
|
def __str__(self):
|
|
63
|
-
|
|
63
|
+
str = ""
|
|
64
|
+
for char in self.alphabet_list:
|
|
65
|
+
str += char
|
|
66
|
+
str += "\n"
|
|
67
|
+
str += "|" * len(self.alphabet_list)
|
|
68
|
+
return str
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from rich.console import Console
|
|
2
2
|
from rich.text import Text
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
from enigmapython.RotatingReflector import RotatingReflector
|
|
4
5
|
|
|
5
6
|
class XRay():
|
|
6
7
|
@staticmethod
|
|
@@ -21,9 +22,13 @@ class XRay():
|
|
|
21
22
|
|
|
22
23
|
rotor_walls_top = " ".join(["+-----+"] * rotor_count)
|
|
23
24
|
|
|
24
|
-
rotors_positions = "
|
|
25
|
+
rotors_positions = " ".join(["{} ({:02})".format(enigma.alphabet_list[enigma.rotors[i].position].upper(),enigma.rotors[i].position) for i in range(rotor_count - 1, -1, -1)])
|
|
26
|
+
|
|
27
|
+
rotors_rings = " ".join(["{} ({:02})".format(enigma.alphabet_list[enigma.rotors[i].ring].upper(),enigma.rotors[i].ring) for i in range(rotor_count - 1, -1, -1)])
|
|
28
|
+
|
|
29
|
+
reflector_ring = ""
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
rotor_walls_position = " ".join(["| {} |".format(enigma.alphabet_list[enigma.rotors[i].position].upper()) for i in range(rotor_count - 1, -1, -1)])
|
|
27
32
|
|
|
28
33
|
rotor_walls = " ".join(["| |"] * rotor_count)
|
|
29
34
|
|
|
@@ -42,17 +47,17 @@ class XRay():
|
|
|
42
47
|
{rotor_numbers}
|
|
43
48
|
+-----+ {rotor_walls_top} +-----+ +-----+
|
|
44
49
|
| | {rotor_walls} | | | |
|
|
45
|
-
| +--|--<--{rotor_wiring_top}|-----|--<--|-----|----< {enigma.journal[-1]['input_char'] if len(enigma.journal) >= 1 else ' '} <-- Key
|
|
50
|
+
| +--|--<--{rotor_wiring_top}|-----|--<--|-----|----< {enigma.journal[-1]['input_char'] if len(enigma.journal) >= 1 else ' '} <-- Key ⌨️
|
|
46
51
|
| | {rotor_walls_forward} | {enigma.etw.journal[-2]['output_char'] if len(enigma.etw.journal) >= 2 else ' '} | | {enigma.plugboard.journal[-2]['output_char'] if len(enigma.plugboard.journal) >= 2 else ' '} | |
|
|
47
52
|
| | | {rotor_walls} | | | |
|
|
48
53
|
| | | {rotor_walls} | | | |
|
|
49
54
|
| | | {enigma.reflector.journal[-1]['output_char'] if len(enigma.reflector.journal) >= 1 else ' '} | {rotor_walls_backward} | {enigma.etw.journal[-1]['output_char'] if len(enigma.etw.journal) >= 2 else ' '} | |
|
|
50
|
-
| +--|-->--{rotor_wiring_bottom}|-----|-->--|-----|----> {enigma.journal[-1]['output_char'] if len(enigma.journal) >= 1 else ' '} --> Lamp
|
|
55
|
+
| +--|-->--{rotor_wiring_bottom}|-----|-->--|-----|----> {enigma.journal[-1]['output_char'] if len(enigma.journal) >= 1 else ' '} --> Lamp 💡
|
|
51
56
|
| | {rotor_walls} | | | |
|
|
52
57
|
+-----+ {rotor_walls_bottom} +-----+ +-----+
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
Pos.: {"{} ({:02})".format(enigma.alphabet_list[enigma.reflector.position].upper(),enigma.reflector.position) if isinstance(enigma.reflector, RotatingReflector) else ' N/A '} {rotors_positions}
|
|
60
|
+
Ring: {"{} ({:02})".format(enigma.alphabet_list[enigma.reflector.ring].upper(),enigma.reflector.ring)} {rotors_rings}
|
|
56
61
|
"""
|
|
57
62
|
console.print(Text(diagram, style="bold"))
|
|
58
63
|
return Text(diagram, style="bold")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Placeholder empty file to make this directory a Python package
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: enigmapython
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: A simple yet faithful library to emulate different Enigma machines models using Python
|
|
5
5
|
Home-page: https://github.com/denismaggior8/enigma-python
|
|
6
6
|
Author: Denis Maggiorotto
|
|
@@ -190,4 +190,6 @@ In the case you leveraged **enigmapython** API in a project, either public or no
|
|
|
190
190
|
|
|
191
191
|
for having helped me testing the correctness of the generated ciphertexts
|
|
192
192
|
|
|
193
|
+
## Support
|
|
193
194
|
|
|
195
|
+
Found it useful/funny/educational? Please consider to [](https://www.buymeacoffee.com/denismaggior8)
|
|
@@ -12,7 +12,7 @@ setup(
|
|
|
12
12
|
long_description_content_type='text/markdown',
|
|
13
13
|
url="https://github.com/denismaggior8/enigma-python",
|
|
14
14
|
name="enigmapython",
|
|
15
|
-
version="1.
|
|
15
|
+
version="1.3.0",
|
|
16
16
|
packages=find_packages(
|
|
17
17
|
# All keyword arguments below are optional:
|
|
18
18
|
where='.', # '.' by default
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|