enigmapython 2.0.2__tar.gz → 3.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.
Files changed (94) hide show
  1. {enigmapython-2.0.2 → enigmapython-3.0.0}/PKG-INFO +15 -15
  2. enigmapython-3.0.0/enigmapython/DynamicTurnoverRotor.py +36 -0
  3. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Enigma.py +2 -3
  4. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaB_A133RotorI.py +2 -2
  5. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaB_A133RotorII.py +2 -2
  6. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaB_A133RotorIII.py +2 -2
  7. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaDRotorI.py +6 -4
  8. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaDRotorII.py +6 -5
  9. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaDRotorIII.py +6 -5
  10. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaINorwayRotorI.py +2 -2
  11. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaINorwayRotorII.py +2 -2
  12. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaINorwayRotorIII.py +2 -2
  13. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaINorwayRotorIV.py +2 -2
  14. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaINorwayRotorV.py +2 -2
  15. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaIRotorI.py +2 -2
  16. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaIRotorII.py +2 -2
  17. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaIRotorIII.py +2 -2
  18. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaIRotorIV.py +2 -2
  19. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaIRotorV.py +2 -2
  20. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaISonderRotorI.py +2 -2
  21. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaISonderRotorII.py +2 -2
  22. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaISonderRotorIII.py +2 -2
  23. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaKRotorI.py +2 -2
  24. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaKRotorII.py +2 -2
  25. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaKRotorIII.py +2 -2
  26. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM3RotorI.py +2 -2
  27. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM3RotorII.py +2 -2
  28. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM3RotorIII.py +2 -2
  29. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM3RotorIV.py +2 -2
  30. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM3RotorV.py +2 -2
  31. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM3RotorVI.py +2 -2
  32. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM3RotorVII.py +2 -2
  33. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM3RotorVIII.py +2 -2
  34. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorBeta.py +2 -2
  35. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorGamma.py +2 -2
  36. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorI.py +2 -2
  37. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorII.py +2 -2
  38. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorIII.py +2 -2
  39. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorIV.py +2 -2
  40. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorV.py +2 -2
  41. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorVI.py +2 -2
  42. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorVII.py +2 -2
  43. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4RotorVIII.py +2 -2
  44. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaZRotorI.py +2 -2
  45. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaZRotorII.py +2 -2
  46. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaZRotorIII.py +2 -2
  47. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKW_EnigmaZ.py +2 -2
  48. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Rotor.py +7 -8
  49. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython.egg-info/PKG-INFO +15 -15
  50. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython.egg-info/SOURCES.txt +1 -0
  51. {enigmapython-2.0.2 → enigmapython-3.0.0}/setup.py +1 -1
  52. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Alphabets.py +0 -0
  53. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Clonable.py +0 -0
  54. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaB_A133.py +0 -0
  55. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaB_A133Etw.py +0 -0
  56. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaD.py +0 -0
  57. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaI.py +0 -0
  58. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaINorway.py +0 -0
  59. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaISonder.py +0 -0
  60. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaK.py +0 -0
  61. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM3.py +0 -0
  62. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaM4.py +0 -0
  63. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaZ.py +0 -0
  64. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EnigmaZEtw.py +0 -0
  65. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Etw.py +0 -0
  66. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EtwPassthrough.py +0 -0
  67. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/EtwQWERTZ.py +0 -0
  68. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Journaled.py +0 -0
  69. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Observable.py +0 -0
  70. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Observer.py +0 -0
  71. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Plugboard.py +0 -0
  72. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/PlugboardPassthrough.py +0 -0
  73. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Reflector.py +0 -0
  74. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKWA.py +0 -0
  75. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKWB.py +0 -0
  76. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKWBThin.py +0 -0
  77. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKWC.py +0 -0
  78. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKWCThin.py +0 -0
  79. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKW_EnigmaB_A133.py +0 -0
  80. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKW_EnigmaCommercial.py +0 -0
  81. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKW_EnigmaINorway.py +0 -0
  82. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/ReflectorUKW_EnigmaISonder.py +0 -0
  83. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/RotatingReflector.py +0 -0
  84. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Scrambler.py +0 -0
  85. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Settable.py +0 -0
  86. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/SettableReflector.py +0 -0
  87. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Swappable.py +0 -0
  88. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/SwappablePlugboard.py +0 -0
  89. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/Utils.py +0 -0
  90. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/XRay.py +0 -0
  91. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython/__init__.py +0 -0
  92. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython.egg-info/dependency_links.txt +0 -0
  93. {enigmapython-2.0.2 → enigmapython-3.0.0}/enigmapython.egg-info/top_level.txt +0 -0
  94. {enigmapython-2.0.2 → enigmapython-3.0.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enigmapython
3
- Version: 2.0.2
3
+ Version: 3.0.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
@@ -82,7 +82,7 @@ The following Enigma machine models (along with their rotors, reflectors and plu
82
82
 
83
83
  ### Enigma B (Sweden, s/n: A-133)*
84
84
 
85
- | Scrambler | Wiring | Notch | Implemented |
85
+ | Scrambler | Wiring | Turnover | Implemented |
86
86
  |------- |---------------------------- |------- |------------- |
87
87
  | ETW (passthrough) | abcdefghijklmnopqrstuvxyzåäö | N/A | ✅ |
88
88
  | Rotor I | psbgöxqjdhoäucfrtezvåinlymka | ä | ✅ |
@@ -94,7 +94,7 @@ The following Enigma machine models (along with their rotors, reflectors and plu
94
94
 
95
95
  ### Enigma K (Commercial Enigma)
96
96
 
97
- | Scrambler | Wiring | Notch | Implemented |
97
+ | Scrambler | Wiring | Turnover | Implemented |
98
98
  |------- |---------------------------- |------- |------------- |
99
99
  | ETW "QWERTZ" | qwertzuioasdfghjkpyxcvbnml | N/A | ✅ |
100
100
  | Rotor I | lpgszmhaeoqkvxrfybutnicjdw | y | ✅ |
@@ -102,21 +102,21 @@ The following Enigma machine models (along with their rotors, reflectors and plu
102
102
  | Rotor III | cjgdpshkturawzxfmynqobvlie | n | ✅ |
103
103
  | Reflector UKW | imetcgfraysqbzxwlhkdvupojn | N/A | ✅ |
104
104
 
105
+ ### Enigma D (Commercial Enigma)
105
106
 
106
- ### Enigma D
107
-
108
- | Scrambler | Wiring | Notch | Implemented |
107
+ | Scrambler | Wiring | Turnover | Implemented |
109
108
  |------- |---------------------------- |------- |------------- |
110
109
  | ETW "QWERTZ" | qwertzuioasdfghjkpyxcvbnml | N/A | ✅ |
111
- | Rotor I | lpgszmhaeoqkvxrfybutnicjdw | y | ✅ |
112
- | Rotor II | slvgbtfxjqohewirzyamkpcndu | e | ✅ |
113
- | Rotor III | bdfhjlcprtxvznyeiwgakmusqo | n | ✅ |
110
+ | Rotor I | lpgszmhaeoqkvxrfybutnicjdw | z* | ✅ |
111
+ | Rotor II | slvgbtfxjqohewirzyamkpcndu | z* | ✅ |
112
+ | Rotor III | cjgdpshkturawzxfmynqobvlie | z* | ✅ |
114
113
  | Reflector UKW | imetcgfraysqbzxwlhkdvupojn | N/A | ✅ |
115
114
 
115
+ *Enigma D rotor turnover happens at Z when ringstellung is 0 (A), otherwise turnover position is calculated using the formula `turnover = (ringstellung + 1) % 26`.
116
116
 
117
117
  ### Enigma Z (Z30 Mark I)*
118
118
 
119
- | Scrambler | Wiring | Notch | Implemented |
119
+ | Scrambler | Wiring | Turnover | Implemented |
120
120
  |------- |----------------------------|-------|-------------|
121
121
  | ETW (passthrough) | 1234567890 | N/A | ✅ |
122
122
  | Rotor I | 6418270359 | 9 | ✅ |
@@ -128,7 +128,7 @@ The following Enigma machine models (along with their rotors, reflectors and plu
128
128
 
129
129
  ### Enigma I
130
130
 
131
- | Scrambler | Wiring | Notch | Implemented |
131
+ | Scrambler | Wiring | Turnover | Implemented |
132
132
  |------- |---------------------------- |------- |------------- |
133
133
  | Plugboard (passthrough+swappable) | N/A | N/A | ✅ |
134
134
  | ETW (passthrough) | abcdefghijklmnopqrstuvwxyz | N/A | ✅ |
@@ -141,7 +141,7 @@ The following Enigma machine models (along with their rotors, reflectors and plu
141
141
 
142
142
  ### Enigma I Norway (Norenigma)
143
143
 
144
- | Scrambler | Wiring | Notch | Implemented |
144
+ | Scrambler | Wiring | Turnover | Implemented |
145
145
  |------- |---------------------------- |------- |------------- |
146
146
  | Plugboard (passthrough+swappable) | N/A | N/A | ✅ |
147
147
  | ETW (passthrough) | abcdefghijklmnopqrstuvwxyz | N/A | ✅ |
@@ -154,7 +154,7 @@ The following Enigma machine models (along with their rotors, reflectors and plu
154
154
 
155
155
  ### Enigma I Sondermaschine (special machine)
156
156
 
157
- | Scrambler | Wiring | Notch | Implemented |
157
+ | Scrambler | Wiring | Turnover | Implemented |
158
158
  |------- |---------------------------- |------- |------------- |
159
159
  | Plugboard (passthrough+swappable) | N/A | N/A | ✅ |
160
160
  | ETW (passthrough) | abcdefghijklmnopqrstuvwxyz | N/A | ✅ |
@@ -166,7 +166,7 @@ The following Enigma machine models (along with their rotors, reflectors and plu
166
166
 
167
167
  ### Enigma M3
168
168
 
169
- | Scrambler | Wiring | Notch | Implemented |
169
+ | Scrambler | Wiring | Turnover | Implemented |
170
170
  |------- |---------------------------- |------- |------------- |
171
171
  | Plugboard (passthrough+swappable) | N/A | N/A | ✅ |
172
172
  | ETW (passthrough) | abcdefghijklmnopqrstuvwxyz | N/A | ✅ |
@@ -183,7 +183,7 @@ The following Enigma machine models (along with their rotors, reflectors and plu
183
183
 
184
184
  ### Enigma M4
185
185
 
186
- | Scrambler | Wiring | Notch | Implemented |
186
+ | Scrambler | Wiring | Turnover | Implemented |
187
187
  |------- |---------------------------- |------- |------------- |
188
188
  | Plugboard (passthrough+swappable) | N/A | N/A | ✅ |
189
189
  | ETW (passthrough) | abcdefghijklmnopqrstuvwxyz | N/A | ✅ |
@@ -0,0 +1,36 @@
1
+ from .Rotor import Rotor
2
+
3
+ class DynamicTurnoverRotor(Rotor):
4
+ """
5
+ Rotor that updates its notch position based on the ring setting using the formula:
6
+ effective_notch = (notch + ringstellung) mod 26
7
+ """
8
+ original_turnover_indexes = None
9
+
10
+ def __init__(self, wiring, turnover_indexes, alphabet, position=0, ring=0, turnover_function=None):
11
+ # We must save the original notch indexes before calling super().__init__
12
+ # because super().__init__ calls set_ring (via Settable), which we override.
13
+ self.original_turnover_indexes = turnover_indexes
14
+
15
+ if turnover_function is None:
16
+ self.turnover_function = lambda notch, ring, length: (notch + ring) % length
17
+ else:
18
+ self.turnover_function = turnover_function
19
+
20
+ super().__init__(wiring, turnover_indexes, alphabet, position, ring)
21
+ # Rotor.__init__ sets self.turnover_indexes = turnover_indexes at the end,
22
+ # overwriting any changes made by our set_ring during init.
23
+ # So we must call set_ring again to ensure notches are calculated correctly.
24
+ self.set_ring(ring)
25
+
26
+ def set_ring(self, ring):
27
+ # First perform standard ring setting (wiring rotation)
28
+ super().set_ring(ring)
29
+
30
+ # Now adjust notch positions using the turnover function
31
+ if self.original_turnover_indexes is not None:
32
+ length = len(self.wiring)
33
+ self.turnover_indexes = []
34
+ for notch in self.original_turnover_indexes:
35
+ new_notch = self.turnover_function(notch, ring, length)
36
+ self.turnover_indexes.append(new_notch)
@@ -107,7 +107,6 @@ class Enigma(Observer,Journaled,Clonable):
107
107
  iteration -=1
108
108
  logging.debug("Scrambled letter from rotor{}: {}".format(str(iteration+1),scrambled_char))
109
109
 
110
- # Processing rotor 1 returning signal by ETW
111
110
  # Processing rotor 1 returning signal by ETW
112
111
  scrambled_char = self.etw.scramble_char(self.alphabet_list,(inverted_wiring.index(self.shift_letter(scrambled_char, (0 - self.rotors[iteration].position),self.alphabet_list))), 0)
113
112
  logging.debug("Scrambled letter from ETW: {}".format(scrambled_char))
@@ -123,14 +122,14 @@ class Enigma(Observer,Journaled,Clonable):
123
122
  self.rotors[self.rotors.index(observable)+1].increment_position()
124
123
  logging.debug("Rotor at index {} has been incremented by 1 position".format(self.rotors.index(observable)+1))
125
124
  # Engaging the enigma double step issue, only if the next rotor position is in its notch indexe/s
126
- if self.rotors[self.rotors.index(observable)+1].position in self.rotors[self.rotors.index(observable)+1].notch_indexes:
125
+ if self.rotors[self.rotors.index(observable)+1].position in self.rotors[self.rotors.index(observable)+1].turnover_indexes:
127
126
  self.rotors[self.rotors.index(observable)+1].double_step_triggered = True
128
127
  # If the rotor is the last one in the list, but the machine has a rotating reflector, increment its position by 1
129
128
  if observable in self.rotors and self.rotors.index(observable) == len(self.rotors)-1 and isinstance(self.reflector, RotatingReflector):
130
129
  self.reflector.increment_position()
131
130
  logging.debug("Reflector has been incremented by 1 position")
132
131
  # Engaging the enigma double step issue, only if the next rotor position is in its notch indexe/s
133
- if self.reflector.position in self.reflector.notch_indexes:
132
+ if self.reflector.position in self.reflector.turnover_indexes:
134
133
  self.reflector.double_step_triggered = True
135
134
 
136
135
  @staticmethod
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaB_A133RotorI(Rotor):
5
5
 
6
6
  wiring = 'psbgöxqjdhoäucfrtezvåinlymka'
7
- notch_indexes = [11]
7
+ turnover_indexes = [11]
8
8
  tag = "B_A133_I"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,7 @@ class EnigmaB_A133RotorI(Rotor):
12
12
  wiring=self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
15
+ turnover_indexes=self.turnover_indexes,
16
16
  alphabet=Alphabets.lookup.get("enigma_b_a133_28chars_lowercase")
17
17
  )
18
18
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaB_A133RotorII(Rotor):
5
5
 
6
6
  wiring = 'chnsyöadmotrzxbäigåekqupflvj'
7
- notch_indexes = [15]
7
+ turnover_indexes = [15]
8
8
  tag = "B_A133_II"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,7 @@ class EnigmaB_A133RotorII(Rotor):
12
12
  wiring=self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
15
+ turnover_indexes=self.turnover_indexes,
16
16
  alphabet=Alphabets.lookup.get("enigma_b_a133_28chars_lowercase")
17
17
  )
18
18
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaB_A133RotorIII(Rotor):
5
5
 
6
6
  wiring = 'åvqiaäxrjbözspcfyunthdomekgl'
7
- notch_indexes = [5]
7
+ turnover_indexes = [5]
8
8
  tag = "B_A133_III"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,7 @@ class EnigmaB_A133RotorIII(Rotor):
12
12
  wiring=self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
15
+ turnover_indexes=self.turnover_indexes,
16
16
  alphabet=Alphabets.lookup.get("enigma_b_a133_28chars_lowercase")
17
17
  )
18
18
 
@@ -1,10 +1,11 @@
1
+ from .DynamicTurnoverRotor import DynamicTurnoverRotor
1
2
  from .Rotor import Rotor
2
3
  from .Alphabets import Alphabets
3
4
 
4
- class EnigmaDRotorI(Rotor):
5
+ class EnigmaDRotorI(DynamicTurnoverRotor):
5
6
 
6
7
  wiring = 'lpgszmhaeoqkvxrfybutnicjdw'
7
- notch_indexes = [24]
8
+ turnover_indexes = [25]
8
9
  tag = "D_I"
9
10
 
10
11
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +13,8 @@ class EnigmaDRotorI(Rotor):
12
13
  wiring=self.wiring,
13
14
  position=position,
14
15
  ring=ring,
15
- notch_indexes=self.notch_indexes,
16
- alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase')
16
+ turnover_indexes=self.turnover_indexes,
17
+ alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase'),
18
+ turnover_function=lambda n, r, l: (n + r) % l
17
19
  )
18
20
 
@@ -1,10 +1,10 @@
1
- from .Rotor import Rotor
1
+ from .DynamicTurnoverRotor import DynamicTurnoverRotor
2
2
  from .Alphabets import Alphabets
3
3
 
4
- class EnigmaDRotorII(Rotor):
4
+ class EnigmaDRotorII(DynamicTurnoverRotor):
5
5
 
6
6
  wiring = 'slvgbtfxjqohewirzyamkpcndu'
7
- notch_indexes = [4]
7
+ turnover_indexes = [25]
8
8
  tag = "D_II"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,8 @@ class EnigmaDRotorII(Rotor):
12
12
  wiring=self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
16
- alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase')
15
+ turnover_indexes=self.turnover_indexes,
16
+ alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase'),
17
+ turnover_function=lambda n, r, l: (n + r) % l
17
18
  )
18
19
 
@@ -1,10 +1,10 @@
1
- from .Rotor import Rotor
1
+ from .DynamicTurnoverRotor import DynamicTurnoverRotor
2
2
  from .Alphabets import Alphabets
3
3
 
4
- class EnigmaDRotorIII(Rotor):
4
+ class EnigmaDRotorIII(DynamicTurnoverRotor):
5
5
 
6
6
  wiring = 'cjgdpshkturawzxfmynqobvlie'
7
- notch_indexes = [13]
7
+ turnover_indexes = [25]
8
8
  tag = "D_III"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,8 @@ class EnigmaDRotorIII(Rotor):
12
12
  wiring=self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
16
- alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase')
15
+ turnover_indexes=self.turnover_indexes,
16
+ alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase'),
17
+ turnover_function=lambda n, r, l: (n + r) % l
17
18
  )
18
19
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaINorwayRotorI(Rotor):
5
5
 
6
6
  wiring = 'wtokasuyvrbxjhqcpzefmdinlg'
7
- notch_indexes = [16]
7
+ turnover_indexes = [16]
8
8
  tag = "IN_I"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,7 @@ class EnigmaINorwayRotorI(Rotor):
12
12
  wiring=self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
15
+ turnover_indexes=self.turnover_indexes,
16
16
  alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase')
17
17
  )
18
18
 
@@ -5,7 +5,7 @@ from .Alphabets import Alphabets
5
5
  class EnigmaINorwayRotorII(Rotor):
6
6
 
7
7
  wiring = 'gjlpubswemctqvhxaofzdrkyni'
8
- notch_indexes = [4]
8
+ turnover_indexes = [4]
9
9
  tag = "IN_II"
10
10
 
11
11
  def __init__(self, position = 0, ring = 0):
@@ -13,6 +13,6 @@ class EnigmaINorwayRotorII(Rotor):
13
13
  wiring=self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase')
18
18
  )
@@ -5,7 +5,7 @@ from .Alphabets import Alphabets
5
5
  class EnigmaINorwayRotorIII(Rotor):
6
6
 
7
7
  wiring = 'jwfmhnbpusdytixvzgrqlaoekc'
8
- notch_indexes = [21]
8
+ turnover_indexes = [21]
9
9
  tag = "IN_III"
10
10
 
11
11
  def __init__(self, position = 0, ring = 0):
@@ -13,7 +13,7 @@ class EnigmaINorwayRotorIII(Rotor):
13
13
  wiring=self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase')
18
18
  )
19
19
 
@@ -5,7 +5,7 @@ from .Alphabets import Alphabets
5
5
  class EnigmaINorwayRotorIV(Rotor):
6
6
 
7
7
  wiring = 'fgzjmvxepbwshqtliudykcnrao'
8
- notch_indexes = [21]
8
+ turnover_indexes = [21]
9
9
  tag = "IN_IV"
10
10
 
11
11
  def __init__(self, position = 0, ring = 0):
@@ -13,7 +13,7 @@ class EnigmaINorwayRotorIV(Rotor):
13
13
  wiring=self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase')
18
18
  )
19
19
 
@@ -5,7 +5,7 @@ from .Alphabets import Alphabets
5
5
  class EnigmaINorwayRotorV(Rotor):
6
6
 
7
7
  wiring = 'hejxqotzbvfdascilwpgynmurk'
8
- notch_indexes = [25]
8
+ turnover_indexes = [25]
9
9
  tag = "IN_V"
10
10
 
11
11
  def __init__(self, position = 0, ring = 0):
@@ -13,7 +13,7 @@ class EnigmaINorwayRotorV(Rotor):
13
13
  wiring=self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get('latin_i18n_26chars_lowercase')
18
18
  )
19
19
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaIRotorI(Rotor):
5
5
 
6
6
  wiring = 'ekmflgdqvzntowyhxuspaibrcj'
7
- notch_indexes = [16]
7
+ turnover_indexes = [16]
8
8
  tag = "I_I"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,7 @@ class EnigmaIRotorI(Rotor):
12
12
  wiring = self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
15
+ turnover_indexes=self.turnover_indexes,
16
16
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
17
17
  )
18
18
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaIRotorII(Rotor):
5
5
 
6
6
  wiring = 'ajdksiruxblhwtmcqgznpyfvoe'
7
- notch_indexes = [4]
7
+ turnover_indexes = [4]
8
8
 
9
9
  tag = "I_II"
10
10
 
@@ -13,7 +13,7 @@ class EnigmaIRotorII(Rotor):
13
13
  wiring = self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
18
18
  )
19
19
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaIRotorIII(Rotor):
5
5
 
6
6
  wiring = 'bdfhjlcprtxvznyeiwgakmusqo'
7
- notch_indexes = [21]
7
+ turnover_indexes = [21]
8
8
 
9
9
  tag = "I_III"
10
10
 
@@ -13,7 +13,7 @@ class EnigmaIRotorIII(Rotor):
13
13
  wiring = self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
18
18
  )
19
19
 
@@ -5,7 +5,7 @@ from .Alphabets import Alphabets
5
5
  class EnigmaIRotorIV(Rotor):
6
6
 
7
7
  wiring = 'esovpzjayquirhxlnftgkdcmwb'
8
- notch_indexes = [9]
8
+ turnover_indexes = [9]
9
9
 
10
10
  tag = "I_IV"
11
11
 
@@ -14,7 +14,7 @@ class EnigmaIRotorIV(Rotor):
14
14
  wiring = self.wiring,
15
15
  position=position,
16
16
  ring=ring,
17
- notch_indexes=self.notch_indexes,
17
+ turnover_indexes=self.turnover_indexes,
18
18
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
19
19
  )
20
20
 
@@ -5,7 +5,7 @@ from .Alphabets import Alphabets
5
5
  class EnigmaIRotorV(Rotor):
6
6
 
7
7
  wiring = 'vzbrgityupsdnhlxawmjqofeck'
8
- notch_indexes = [25]
8
+ turnover_indexes = [25]
9
9
  tag = "I_V"
10
10
 
11
11
  def __init__(self, position = 0, ring = 0):
@@ -13,7 +13,7 @@ class EnigmaIRotorV(Rotor):
13
13
  wiring = self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
18
18
  )
19
19
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaISonderRotorI(Rotor):
5
5
 
6
6
  wiring = 'veosirzujdqckgwypnxaflthmb'
7
- notch_indexes = [16]
7
+ turnover_indexes = [16]
8
8
  tag = "IS_I"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,7 @@ class EnigmaISonderRotorI(Rotor):
12
12
  wiring = self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
15
+ turnover_indexes=self.turnover_indexes,
16
16
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
17
17
  )
18
18
 
@@ -5,7 +5,7 @@ from .Alphabets import Alphabets
5
5
  class EnigmaISonderRotorII(Rotor):
6
6
 
7
7
  wiring = 'uemoatqlshpkcyfwjzbgvxidnr'
8
- notch_indexes = [4]
8
+ turnover_indexes = [4]
9
9
  tag = "IS_II"
10
10
 
11
11
  def __init__(self, position = 0, ring = 0):
@@ -13,6 +13,6 @@ class EnigmaISonderRotorII(Rotor):
13
13
  wiring = self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
18
18
  )
@@ -5,7 +5,7 @@ from .Alphabets import Alphabets
5
5
  class EnigmaISonderRotorIII(Rotor):
6
6
 
7
7
  wiring = 'tzhxmbsipnurjfdkeqvcwglaoy'
8
- notch_indexes = [21]
8
+ turnover_indexes = [21]
9
9
  tag = "IS_III"
10
10
 
11
11
  def __init__(self, position = 0, ring = 0):
@@ -13,7 +13,7 @@ class EnigmaISonderRotorIII(Rotor):
13
13
  wiring = self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
18
18
  )
19
19
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaKRotorI(Rotor):
5
5
 
6
6
  wiring = 'lpgszmhaeoqkvxrfybutnicjdw'
7
- notch_indexes = [24] # Y (notch position)
7
+ turnover_indexes = [24] # Y (notch position)
8
8
  tag = "K_I"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,7 @@ class EnigmaKRotorI(Rotor):
12
12
  wiring = self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
15
+ turnover_indexes=self.turnover_indexes,
16
16
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
17
17
  )
18
18
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaKRotorII(Rotor):
5
5
 
6
6
  wiring = 'slvgbtfxjqohewirzyamkpcndu'
7
- notch_indexes = [4] # E (notch position)
7
+ turnover_indexes = [4] # E (notch position)
8
8
  tag = "K_II"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,7 @@ class EnigmaKRotorII(Rotor):
12
12
  wiring = self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
15
+ turnover_indexes=self.turnover_indexes,
16
16
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
17
17
  )
18
18
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaKRotorIII(Rotor):
5
5
 
6
6
  wiring = 'cjgdpshkturawzxfmynqobvlie'
7
- notch_indexes = [13] # N (position 13)
7
+ turnover_indexes = [13] # N (position 13)
8
8
  tag = "K_III"
9
9
 
10
10
  def __init__(self, position = 0, ring = 0):
@@ -12,7 +12,7 @@ class EnigmaKRotorIII(Rotor):
12
12
  wiring = self.wiring,
13
13
  position=position,
14
14
  ring=ring,
15
- notch_indexes=self.notch_indexes,
15
+ turnover_indexes=self.turnover_indexes,
16
16
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
17
17
  )
18
18
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaM3RotorI(Rotor):
5
5
 
6
6
  wiring = 'ekmflgdqvzntowyhxuspaibrcj'
7
- notch_indexes = [16]
7
+ turnover_indexes = [16]
8
8
 
9
9
  tag = "M3_I"
10
10
 
@@ -13,7 +13,7 @@ class EnigmaM3RotorI(Rotor):
13
13
  wiring = self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
18
18
  )
19
19
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaM3RotorII(Rotor):
5
5
 
6
6
  wiring = 'ajdksiruxblhwtmcqgznpyfvoe'
7
- notch_indexes = [4]
7
+ turnover_indexes = [4]
8
8
 
9
9
  tag = "M3_II"
10
10
 
@@ -13,7 +13,7 @@ class EnigmaM3RotorII(Rotor):
13
13
  wiring = self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
18
18
  )
19
19
 
@@ -4,7 +4,7 @@ from .Alphabets import Alphabets
4
4
  class EnigmaM3RotorIII(Rotor):
5
5
 
6
6
  wiring = 'bdfhjlcprtxvznyeiwgakmusqo'
7
- notch_indexes = [21]
7
+ turnover_indexes = [21]
8
8
 
9
9
  tag = "M3_III"
10
10
 
@@ -13,7 +13,7 @@ class EnigmaM3RotorIII(Rotor):
13
13
  wiring = self.wiring,
14
14
  position=position,
15
15
  ring=ring,
16
- notch_indexes=self.notch_indexes,
16
+ turnover_indexes=self.turnover_indexes,
17
17
  alphabet=Alphabets.lookup.get("latin_i18n_26chars_lowercase")
18
18
  )
19
19