passphera-core 0.30.1__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.
@@ -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
- if self.algorithm.lower() not in _cipher_registry:
100
+ algo_name = self.algorithm.lower()
101
+ if algo_name not in _cipher_registry:
101
102
  raise InvalidAlgorithmException(self.algorithm)
102
- return _cipher_registry[self.algorithm.lower()]
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
  """
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: passphera-core
3
- Version: 0.30.1
3
+ Version: 0.30.2
4
4
  Summary: The core system of passphera project
5
5
  Home-page: https://github.com/passphera/core
6
6
  Author: Fathi Abdelmalek
@@ -1,12 +1,12 @@
1
1
  passphera_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- passphera_core/entities.py,sha256=fUCjf7D9FCKEB2tMoNUr9RJLn_50qcggTDOrBhGEHVI,8892
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.1.dist-info/METADATA,sha256=yQf5woOolmMgufQYpwSqlJN_KcdMthXzM1nPaF93vfI,868
10
- passphera_core-0.30.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- passphera_core-0.30.1.dist-info/top_level.txt,sha256=aDUX2iWGOyfzyf6XakLWTbgeWqNrypMHO074Qratyds,15
12
- passphera_core-0.30.1.dist-info/RECORD,,
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,,