passphera-core 0.30.0__py3-none-any.whl → 0.30.2__py3-none-any.whl
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.
- passphera_core/entities.py +15 -5
- {passphera_core-0.30.0.dist-info → passphera_core-0.30.2.dist-info}/METADATA +1 -1
- {passphera_core-0.30.0.dist-info → passphera_core-0.30.2.dist-info}/RECORD +5 -5
- {passphera_core-0.30.0.dist-info → passphera_core-0.30.2.dist-info}/WHEEL +0 -0
- {passphera_core-0.30.0.dist-info → passphera_core-0.30.2.dist-info}/top_level.txt +0 -0
passphera_core/entities.py
CHANGED
@@ -97,9 +97,19 @@ class Generator:
|
|
97
97
|
Get the primary algorithm used to cipher the password
|
98
98
|
:return: BaseCipherAlgorithm: The primary algorithm used for the cipher
|
99
99
|
"""
|
100
|
-
|
100
|
+
algo_name = self.algorithm.lower()
|
101
|
+
if algo_name not in _cipher_registry:
|
101
102
|
raise InvalidAlgorithmException(self.algorithm)
|
102
|
-
|
103
|
+
AlgoClass = _cipher_registry[algo_name]
|
104
|
+
if algo_name == "caesar":
|
105
|
+
return AlgoClass(self.shift)
|
106
|
+
elif algo_name == "affine":
|
107
|
+
return AlgoClass(self.shift, self.multiplier)
|
108
|
+
elif algo_name == "playfair":
|
109
|
+
return AlgoClass(self.key)
|
110
|
+
elif algo_name == "hill":
|
111
|
+
return AlgoClass(self.key)
|
112
|
+
raise InvalidAlgorithmException(self.algorithm)
|
103
113
|
|
104
114
|
def get_properties(self) -> dict:
|
105
115
|
"""
|
@@ -131,7 +141,7 @@ class Generator:
|
|
131
141
|
:raises ValueError: If the property name is not one of the allowed properties
|
132
142
|
:return: None
|
133
143
|
"""
|
134
|
-
if prop not in {"shift", "multiplier", "key", "algorithm", "prefix", "postfix"}:
|
144
|
+
if prop not in {"id", "created_at", "updated_at", "shift", "multiplier", "key", "algorithm", "prefix", "postfix"}:
|
135
145
|
raise InvalidPropertyNameException(prop)
|
136
146
|
if prop in ["shift", "multiplier"]:
|
137
147
|
value = int(value)
|
@@ -147,7 +157,7 @@ class Generator:
|
|
147
157
|
:raises ValueError: If the property name is not one of the allowed properties
|
148
158
|
:return: None
|
149
159
|
"""
|
150
|
-
if prop not in {"shift", "multiplier", "key", "algorithm", "prefix", "postfix"}:
|
160
|
+
if prop not in {"id", "created_at", "updated_at", "shift", "multiplier", "key", "algorithm", "prefix", "postfix"}:
|
151
161
|
raise InvalidPropertyNameException(prop)
|
152
162
|
setattr(self, prop, _default_properties[prop])
|
153
163
|
if prop == "algorithm":
|
@@ -191,7 +201,7 @@ class Generator:
|
|
191
201
|
main_algorithm: BaseCipherAlgorithm = self.get_algorithm()
|
192
202
|
secondary_algorithm: AffineCipherAlgorithm = AffineCipherAlgorithm(self.shift, self.multiplier)
|
193
203
|
intermediate: str = secondary_algorithm.encrypt(f"{self.prefix}{text}{self.postfix}")
|
194
|
-
password: str = main_algorithm.encrypt(intermediate)
|
204
|
+
password: str = main_algorithm.encrypt(f"{self.prefix}{intermediate}{self.postfix}")
|
195
205
|
password = password.translate(str.maketrans(self.characters_replacements))
|
196
206
|
return ''.join(c.upper() if c in text else c for c in password)
|
197
207
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
passphera_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
passphera_core/entities.py,sha256=
|
2
|
+
passphera_core/entities.py,sha256=sZYUQC7yGwsQ4ughai_QG_-TN-sVEMCpaBi8SJ0uyts,9321
|
3
3
|
passphera_core/exceptions.py,sha256=Tqb-FKJ1_JfX5gSC8Wc0CP84AhwouvnP2gkg83xAlUY,786
|
4
4
|
passphera_core/interfaces.py,sha256=DpHFh_vnamORf69P1dwLrZ8AYZPcYIol0Lq_VKRBkXc,855
|
5
5
|
passphera_core/utilities.py,sha256=n7cAVox-yGd60595RjLvrGKSGqFQRm279YqKS3-R1X0,748
|
6
6
|
passphera_core/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
passphera_core/application/generator.py,sha256=hBSk6vktJ2KPxzKSRnH_WVnCvg7vOHVzN-TQ5GdgXEQ,2769
|
8
8
|
passphera_core/application/password.py,sha256=9wsSz3uMWEZCgfnX5V7WYiWp2OqjSmsn6OSWK4HIIfo,2876
|
9
|
-
passphera_core-0.30.
|
10
|
-
passphera_core-0.30.
|
11
|
-
passphera_core-0.30.
|
12
|
-
passphera_core-0.30.
|
9
|
+
passphera_core-0.30.2.dist-info/METADATA,sha256=5-jCeM8j_Yx0Q0EaWtc_knE22pK78rv7o9xIRc5Szc4,868
|
10
|
+
passphera_core-0.30.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
11
|
+
passphera_core-0.30.2.dist-info/top_level.txt,sha256=aDUX2iWGOyfzyf6XakLWTbgeWqNrypMHO074Qratyds,15
|
12
|
+
passphera_core-0.30.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|