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.
Files changed (90) hide show
  1. {enigmapython-1.2.2 → enigmapython-1.3.0}/PKG-INFO +4 -2
  2. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Enigma.py +1 -1
  3. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Etw.py +4 -1
  4. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Plugboard.py +4 -1
  5. enigmapython-1.3.0/enigmapython/Reflector.py +10 -0
  6. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Rotor.py +7 -2
  7. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Scrambler.py +6 -1
  8. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/XRay.py +12 -7
  9. enigmapython-1.3.0/enigmapython/__init__.py +1 -0
  10. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython.egg-info/PKG-INFO +4 -2
  11. {enigmapython-1.2.2 → enigmapython-1.3.0}/setup.py +1 -1
  12. enigmapython-1.2.2/enigmapython/Reflector.py +0 -4
  13. enigmapython-1.2.2/enigmapython/__init__.py +0 -0
  14. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Alphabets.py +0 -0
  15. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Clonable.py +0 -0
  16. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133.py +0 -0
  17. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133Etw.py +0 -0
  18. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133RotorI.py +0 -0
  19. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133RotorII.py +0 -0
  20. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaB_A133RotorIII.py +0 -0
  21. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaD.py +0 -0
  22. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDEtw_JWULCM.py +0 -0
  23. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDEtw_QWERTZ.py +0 -0
  24. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDRotorI.py +0 -0
  25. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDRotorII.py +0 -0
  26. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaDRotorIII.py +0 -0
  27. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaI.py +0 -0
  28. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorway.py +0 -0
  29. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorI.py +0 -0
  30. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorII.py +0 -0
  31. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorIII.py +0 -0
  32. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorIV.py +0 -0
  33. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaINorwayRotorV.py +0 -0
  34. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorI.py +0 -0
  35. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorII.py +0 -0
  36. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorIII.py +0 -0
  37. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorIV.py +0 -0
  38. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaIRotorV.py +0 -0
  39. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaISonder.py +0 -0
  40. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaISonderRotorI.py +0 -0
  41. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaISonderRotorII.py +0 -0
  42. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaISonderRotorIII.py +0 -0
  43. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3.py +0 -0
  44. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorI.py +0 -0
  45. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorII.py +0 -0
  46. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorIII.py +0 -0
  47. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorIV.py +0 -0
  48. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorV.py +0 -0
  49. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorVI.py +0 -0
  50. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorVII.py +0 -0
  51. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM3RotorVIII.py +0 -0
  52. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4.py +0 -0
  53. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorBeta.py +0 -0
  54. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorGamma.py +0 -0
  55. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorI.py +0 -0
  56. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorII.py +0 -0
  57. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorIII.py +0 -0
  58. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorIV.py +0 -0
  59. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorV.py +0 -0
  60. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorVI.py +0 -0
  61. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorVII.py +0 -0
  62. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaM4RotorVIII.py +0 -0
  63. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZ.py +0 -0
  64. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZEtw.py +0 -0
  65. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZRotorI.py +0 -0
  66. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZRotorII.py +0 -0
  67. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EnigmaZRotorIII.py +0 -0
  68. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/EtwPassthrough.py +0 -0
  69. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Journaled.py +0 -0
  70. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Observable.py +0 -0
  71. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Observer.py +0 -0
  72. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/PlugboardPassthrough.py +0 -0
  73. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorDUKW.py +0 -0
  74. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorNorwayUKW.py +0 -0
  75. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorSonderUKW.py +0 -0
  76. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWA.py +0 -0
  77. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWB.py +0 -0
  78. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWBThin.py +0 -0
  79. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWC.py +0 -0
  80. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKWCThin.py +0 -0
  81. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorUKW_EnigmaB_A133.py +0 -0
  82. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/ReflectorZUKW.py +0 -0
  83. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/RotatingReflector.py +0 -0
  84. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Swappable.py +0 -0
  85. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/SwappablePlugboard.py +0 -0
  86. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython/Utils.py +0 -0
  87. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython.egg-info/SOURCES.txt +0 -0
  88. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython.egg-info/dependency_links.txt +0 -0
  89. {enigmapython-1.2.2 → enigmapython-1.3.0}/enigmapython.egg-info/top_level.txt +0 -0
  90. {enigmapython-1.2.2 → enigmapython-1.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: enigmapython
3
- Version: 1.2.2
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 [![Buy Me a Coffee](https://img.shields.io/badge/buy_me_a_coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](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 it position by 1
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")
@@ -16,4 +16,7 @@ class Etw(Scrambler):
16
16
  self.alphabet_list = list(alphabet)
17
17
 
18
18
  def __str__(self):
19
- return self.wiring
19
+ str = Scrambler.__str__(self)
20
+ str += "\n"
21
+ str += self.wiring
22
+ return str
@@ -17,4 +17,7 @@ class Plugboard(Scrambler):
17
17
 
18
18
 
19
19
  def __str__(self):
20
- return self.wiring
20
+ str = Scrambler.__str__(self)
21
+ str += "\n"
22
+ str += self.wiring
23
+ return str
@@ -0,0 +1,10 @@
1
+ from .Scrambler import Scrambler
2
+
3
+ class Reflector(Scrambler):
4
+ tag = None
5
+
6
+ def __str__(self):
7
+ str = Scrambler.__str__(self)
8
+ str += "\n"
9
+ str += self.wiring
10
+ return str
@@ -40,8 +40,13 @@ class Rotor(Scrambler,Observable):
40
40
 
41
41
 
42
42
  def __str__(self):
43
- pointer = ' ' * self.position + '^'
44
- return self.wiring + '\n' + pointer
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
- return self.wiring
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
- from enigmapython.RotatingReflector import RotatingReflector
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 = " ".join(["{:02}".format(enigma.rotors[i].position) for i in range(rotor_count - 1, -1, -1)])
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
- rotors_rings = " ".join(["{:02}".format(enigma.rotors[i].ring) for i in range(rotor_count - 1, -1, -1)])
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
- Pos.: {"{:02}".format(enigma.reflector.position) if isinstance(enigma.reflector, RotatingReflector) else ' '} {rotors_positions}
55
- Ring: {rotors_rings}
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.2
1
+ Metadata-Version: 2.4
2
2
  Name: enigmapython
3
- Version: 1.2.2
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 [![Buy Me a Coffee](https://img.shields.io/badge/buy_me_a_coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](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.2.2",
15
+ version="1.3.0",
16
16
  packages=find_packages(
17
17
  # All keyword arguments below are optional:
18
18
  where='.', # '.' by default
@@ -1,4 +0,0 @@
1
- from .Scrambler import Scrambler
2
-
3
- class Reflector(Scrambler):
4
- tag = None
File without changes
File without changes