enigmapython 1.2.0__tar.gz → 1.2.2__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.0 → enigmapython-1.2.2}/PKG-INFO +7 -2
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Clonable.py +4 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/SwappablePlugboard.py +0 -1
- enigmapython-1.2.2/enigmapython/Utils.py +51 -0
- enigmapython-1.2.0/enigmapython/Utils.py → enigmapython-1.2.2/enigmapython/XRay.py +4 -64
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython.egg-info/PKG-INFO +7 -2
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython.egg-info/SOURCES.txt +1 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/setup.py +1 -1
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Alphabets.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Enigma.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaB_A133.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaB_A133Etw.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaB_A133RotorI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaB_A133RotorII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaB_A133RotorIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaD.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaDEtw_JWULCM.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaDEtw_QWERTZ.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaDRotorI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaDRotorII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaDRotorIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaINorway.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaINorwayRotorI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaINorwayRotorII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaINorwayRotorIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaINorwayRotorIV.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaINorwayRotorV.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaIRotorI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaIRotorII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaIRotorIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaIRotorIV.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaIRotorV.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaISonder.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaISonderRotorI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaISonderRotorII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaISonderRotorIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM3.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM3RotorI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM3RotorII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM3RotorIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM3RotorIV.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM3RotorV.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM3RotorVI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM3RotorVII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM3RotorVIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorBeta.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorGamma.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorIV.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorV.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorVI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorVII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaM4RotorVIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaZ.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaZEtw.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaZRotorI.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaZRotorII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EnigmaZRotorIII.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Etw.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/EtwPassthrough.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Journaled.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Observable.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Observer.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Plugboard.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/PlugboardPassthrough.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Reflector.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorDUKW.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorNorwayUKW.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorSonderUKW.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorUKWA.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorUKWB.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorUKWBThin.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorUKWC.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorUKWCThin.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorUKW_EnigmaB_A133.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/ReflectorZUKW.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/RotatingReflector.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Rotor.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Scrambler.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/Swappable.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython/__init__.py +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython.egg-info/dependency_links.txt +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/enigmapython.egg-info/top_level.txt +0 -0
- {enigmapython-1.2.0 → enigmapython-1.2.2}/setup.cfg +0 -0
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: enigmapython
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
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
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: description
|
|
10
|
+
Dynamic: description-content-type
|
|
11
|
+
Dynamic: home-page
|
|
12
|
+
Dynamic: summary
|
|
8
13
|
|
|
9
14
|
# Enigma Python library
|
|
10
15
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
class Utils:
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@staticmethod
|
|
6
|
+
def find_divergence(str1, str2):
|
|
7
|
+
"""
|
|
8
|
+
Finds the index where two strings first diverge,
|
|
9
|
+
and the characters at that index in both strings.
|
|
10
|
+
|
|
11
|
+
Parameters:
|
|
12
|
+
str1 (str): The first string.
|
|
13
|
+
str2 (str): The second string.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
tuple: (index, char1, char2) where index is the position of divergence,
|
|
17
|
+
char1 is the character in str1 at the divergence,
|
|
18
|
+
and char2 is the character in str2 at the divergence.
|
|
19
|
+
If the strings only diverge in length, char1 and char2 will be None.
|
|
20
|
+
If the strings are identical, returns None.
|
|
21
|
+
"""
|
|
22
|
+
# Iterate through both strings up to the length of the shorter string
|
|
23
|
+
for i in range(min(len(str1), len(str2))):
|
|
24
|
+
if str1[i] != str2[i]:
|
|
25
|
+
return i, str1[i], str2[i] # Return the index and differing characters
|
|
26
|
+
|
|
27
|
+
# If the strings differ in length
|
|
28
|
+
if len(str1) != len(str2):
|
|
29
|
+
return min(len(str1), len(str2)), None, None
|
|
30
|
+
|
|
31
|
+
# If the strings are identical
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
@staticmethod
|
|
35
|
+
def find_all_subclasses(cls):
|
|
36
|
+
return set(cls.__subclasses__()).union(
|
|
37
|
+
[s for c in cls.__subclasses__() for s in Utils.find_all_subclasses(c)])
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def swap_chars(string, ch1, ch2):
|
|
41
|
+
if ch1 == ch2: return string
|
|
42
|
+
str_list = []
|
|
43
|
+
for char in string:
|
|
44
|
+
if char == ch1:
|
|
45
|
+
str_list.append(ch2)
|
|
46
|
+
elif char == ch2:
|
|
47
|
+
str_list.append(ch1)
|
|
48
|
+
else:
|
|
49
|
+
str_list.append(char)
|
|
50
|
+
return ''.join(str_list)
|
|
51
|
+
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
from importlib import import_module
|
|
2
1
|
from rich.console import Console
|
|
3
2
|
from rich.text import Text
|
|
4
|
-
from enigmapython.RotatingReflector import RotatingReflector
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Utils:
|
|
3
|
+
from enigmapython.RotatingReflector import RotatingReflector
|
|
8
4
|
|
|
5
|
+
class XRay():
|
|
9
6
|
@staticmethod
|
|
10
|
-
def
|
|
7
|
+
def render_enigma_xray(enigma):
|
|
11
8
|
"""
|
|
12
9
|
Render the Enigma Z ASCII diagram with a variable number of rotors.
|
|
13
10
|
UKW, ETW and Plugboard are always visible. The rotor numbers start from 0.
|
|
@@ -58,61 +55,4 @@ class Utils:
|
|
|
58
55
|
Ring: {rotors_rings}
|
|
59
56
|
"""
|
|
60
57
|
console.print(Text(diagram, style="bold"))
|
|
61
|
-
return Text(diagram, style="bold")
|
|
62
|
-
|
|
63
|
-
@staticmethod
|
|
64
|
-
def find_divergence(str1, str2):
|
|
65
|
-
"""
|
|
66
|
-
Finds the index where two strings first diverge,
|
|
67
|
-
and the characters at that index in both strings.
|
|
68
|
-
|
|
69
|
-
Parameters:
|
|
70
|
-
str1 (str): The first string.
|
|
71
|
-
str2 (str): The second string.
|
|
72
|
-
|
|
73
|
-
Returns:
|
|
74
|
-
tuple: (index, char1, char2) where index is the position of divergence,
|
|
75
|
-
char1 is the character in str1 at the divergence,
|
|
76
|
-
and char2 is the character in str2 at the divergence.
|
|
77
|
-
If the strings only diverge in length, char1 and char2 will be None.
|
|
78
|
-
If the strings are identical, returns None.
|
|
79
|
-
"""
|
|
80
|
-
# Iterate through both strings up to the length of the shorter string
|
|
81
|
-
for i in range(min(len(str1), len(str2))):
|
|
82
|
-
if str1[i] != str2[i]:
|
|
83
|
-
return i, str1[i], str2[i] # Return the index and differing characters
|
|
84
|
-
|
|
85
|
-
# If the strings differ in length
|
|
86
|
-
if len(str1) != len(str2):
|
|
87
|
-
return min(len(str1), len(str2)), None, None
|
|
88
|
-
|
|
89
|
-
# If the strings are identical
|
|
90
|
-
return None
|
|
91
|
-
|
|
92
|
-
@staticmethod
|
|
93
|
-
def find_all_subclasses(cls):
|
|
94
|
-
return set(cls.__subclasses__()).union(
|
|
95
|
-
[s for c in cls.__subclasses__() for s in Utils.find_all_subclasses(c)])
|
|
96
|
-
|
|
97
|
-
@staticmethod
|
|
98
|
-
def get_class_instance(cls):
|
|
99
|
-
try:
|
|
100
|
-
module_path, class_name = cls.rsplit('.', 1)
|
|
101
|
-
module = import_module(module_path)
|
|
102
|
-
return getattr(module, class_name)
|
|
103
|
-
except (ImportError, AttributeError) as e:
|
|
104
|
-
raise ImportError(cls)
|
|
105
|
-
|
|
106
|
-
@staticmethod
|
|
107
|
-
def swap_chars(string, ch1, ch2):
|
|
108
|
-
if ch1 == ch2: return string
|
|
109
|
-
str_list = []
|
|
110
|
-
for char in string:
|
|
111
|
-
if char == ch1:
|
|
112
|
-
str_list.append(ch2)
|
|
113
|
-
elif char == ch2:
|
|
114
|
-
str_list.append(ch1)
|
|
115
|
-
else:
|
|
116
|
-
str_list.append(char)
|
|
117
|
-
return ''.join(str_list)
|
|
118
|
-
|
|
58
|
+
return Text(diagram, style="bold")
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: enigmapython
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
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
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: description
|
|
10
|
+
Dynamic: description-content-type
|
|
11
|
+
Dynamic: home-page
|
|
12
|
+
Dynamic: summary
|
|
8
13
|
|
|
9
14
|
# Enigma Python library
|
|
10
15
|
|
|
@@ -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.
|
|
15
|
+
version="1.2.2",
|
|
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
|
|
File without changes
|
|
File without changes
|