passphera-core 0.5.0__tar.gz → 0.7.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: passphera-core
3
- Version: 0.5.0
3
+ Version: 0.7.0
4
4
  Summary: The core system of passphera project
5
5
  Home-page: https://github.com/passphera/core
6
6
  Author: Fathi Abdelmalek
@@ -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(self._password)
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
- self._password = self.generate_raw_password()
178
+ password = self.generate_raw_password(text)
205
179
  self._algorithm_name = old_algorithm
206
- self._password = self.generate_raw_password()
207
- for char in self._password:
208
- if char in self._text:
209
- self._password = self._password.replace(char, char.upper())
180
+ password = self.generate_raw_password(password)
210
181
  for char, replacement in self._characters_replacements.items():
211
- self._password = self._password.replace(char, replacement)
212
- return self._password
182
+ password = password.replace(char, replacement)
183
+ for char in password:
184
+ if char in text:
185
+ password = password.replace(char, char.upper())
186
+ return password
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: passphera-core
3
- Version: 0.5.0
3
+ Version: 0.7.0
4
4
  Summary: The core system of passphera project
5
5
  Home-page: https://github.com/passphera/core
6
6
  Author: Fathi Abdelmalek
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name='passphera-core',
8
- version='0.5.0',
8
+ version='0.7.0',
9
9
  author='Fathi Abdelmalek',
10
10
  author_email='abdelmalek.fathi.2001@gmail.com',
11
11
  url='https://github.com/passphera/core',
File without changes
File without changes