passphera-core 0.5.0__tar.gz → 0.6.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.
- {passphera-core-0.5.0 → passphera-core-0.6.0}/PKG-INFO +1 -1
- {passphera-core-0.5.0 → passphera-core-0.6.0}/passphera_core/generator.py +10 -36
- {passphera-core-0.5.0 → passphera-core-0.6.0}/passphera_core.egg-info/PKG-INFO +1 -1
- {passphera-core-0.5.0 → passphera-core-0.6.0}/setup.py +1 -1
- {passphera-core-0.5.0 → passphera-core-0.6.0}/README.md +0 -0
- {passphera-core-0.5.0 → passphera-core-0.6.0}/passphera_core/__init__.py +0 -0
- {passphera-core-0.5.0 → passphera-core-0.6.0}/passphera_core/exceptions.py +0 -0
- {passphera-core-0.5.0 → passphera-core-0.6.0}/passphera_core.egg-info/SOURCES.txt +0 -0
- {passphera-core-0.5.0 → passphera-core-0.6.0}/passphera_core.egg-info/dependency_links.txt +0 -0
- {passphera-core-0.5.0 → passphera-core-0.6.0}/passphera_core.egg-info/top_level.txt +0 -0
- {passphera-core-0.5.0 → passphera-core-0.6.0}/setup.cfg +0 -0
@@ -14,7 +14,6 @@ class PasswordGenerator:
|
|
14
14
|
key: str = "hill",
|
15
15
|
algorithm: str = 'hill',
|
16
16
|
characters_replacements: dict = None,
|
17
|
-
text: str = None,
|
18
17
|
):
|
19
18
|
"""
|
20
19
|
:param shift: number of characters to shift each character (default 3)
|
@@ -32,31 +31,6 @@ class PasswordGenerator:
|
|
32
31
|
self._algorithm_name: str = algorithm.lower()
|
33
32
|
self._algorithm = self._set_algorithm()
|
34
33
|
self._characters_replacements: dict = characters_replacements
|
35
|
-
self._text: str = text
|
36
|
-
if text:
|
37
|
-
self._password: str = f"secret{self._text.replace(' ', '')}secret"
|
38
|
-
else:
|
39
|
-
self._password: str = f'secret'
|
40
|
-
|
41
|
-
@property
|
42
|
-
def text(self) -> str:
|
43
|
-
"""
|
44
|
-
Returns the text to be ciphered into a password
|
45
|
-
Eg: ```password = pg.text```
|
46
|
-
:return: str: The text to be ciphered into a password
|
47
|
-
"""
|
48
|
-
return self._text
|
49
|
-
|
50
|
-
@text.setter
|
51
|
-
def text(self, text: str) -> None:
|
52
|
-
"""
|
53
|
-
Sets the text to be ciphered into a password
|
54
|
-
Eg: ```pg.text = 'secret 2024 password'```
|
55
|
-
:param text: The text to be ciphered into a password
|
56
|
-
:return:
|
57
|
-
"""
|
58
|
-
self._text = text
|
59
|
-
self._password: str = f"secret{self._text.replace(' ', '')}secret"
|
60
34
|
|
61
35
|
@property
|
62
36
|
def shift(self) -> int:
|
@@ -186,27 +160,27 @@ class PasswordGenerator:
|
|
186
160
|
if char in self._characters_replacements:
|
187
161
|
del self._characters_replacements[char]
|
188
162
|
|
189
|
-
def generate_raw_password(self) -> str:
|
163
|
+
def generate_raw_password(self, text: str) -> str:
|
190
164
|
"""
|
191
165
|
Generate a raw password string using the given parameters
|
192
166
|
:return: str: The generated raw password
|
193
167
|
"""
|
194
168
|
self._update_algorithm_properties()
|
195
|
-
return self._algorithm.encrypt(
|
169
|
+
return self._algorithm.encrypt(f"secret{text}secret")
|
196
170
|
|
197
|
-
def generate_password(self) -> str:
|
171
|
+
def generate_password(self, text: str) -> str:
|
198
172
|
"""
|
199
173
|
Generate a strong password string using the raw password (add another layer of encryption to it)
|
200
174
|
:return: str: The generated strong password
|
201
175
|
"""
|
202
176
|
old_algorithm = self._algorithm_name
|
203
177
|
self._algorithm_name = 'affine'
|
204
|
-
|
178
|
+
password = self.generate_raw_password(text)
|
205
179
|
self._algorithm_name = old_algorithm
|
206
|
-
|
207
|
-
for char in
|
208
|
-
if char in
|
209
|
-
|
180
|
+
password = self.generate_raw_password(password)
|
181
|
+
for char in password:
|
182
|
+
if char in text:
|
183
|
+
password = password.replace(char, char.upper())
|
210
184
|
for char, replacement in self._characters_replacements.items():
|
211
|
-
|
212
|
-
return
|
185
|
+
password = password.replace(char, replacement)
|
186
|
+
return password
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|