passphera-core 0.3.4__py3-none-any.whl → 0.4.0__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/__init__.py +2 -2
- passphera_core/exceptions.py +1 -1
- passphera_core/generator.py +13 -35
- {passphera_core-0.3.4.dist-info → passphera_core-0.4.0.dist-info}/METADATA +2 -2
- passphera_core-0.4.0.dist-info/RECORD +7 -0
- passphera_core-0.3.4.dist-info/RECORD +0 -7
- {passphera_core-0.3.4.dist-info → passphera_core-0.4.0.dist-info}/WHEEL +0 -0
- {passphera_core-0.3.4.dist-info → passphera_core-0.4.0.dist-info}/top_level.txt +0 -0
passphera_core/__init__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
from .generator import PasswordGenerator
|
2
|
-
from .exceptions import InvalidAlgorithmException
|
1
|
+
from passphera_core.generator import PasswordGenerator
|
2
|
+
from passphera_core.exceptions import InvalidAlgorithmException
|
passphera_core/exceptions.py
CHANGED
passphera_core/generator.py
CHANGED
@@ -12,24 +12,21 @@ class PasswordGenerator:
|
|
12
12
|
text: str = None,
|
13
13
|
shift: int = 3,
|
14
14
|
multiplier: int = 3,
|
15
|
-
|
16
|
-
|
17
|
-
algorithm: str = 'playfair'
|
15
|
+
key: str = "hill",
|
16
|
+
algorithm: str = 'hill'
|
18
17
|
):
|
19
18
|
"""
|
20
19
|
:param text: plain text to be ciphered
|
21
20
|
:param shift: number of characters to shift each character (default 3)
|
22
21
|
:param multiplier: number of characters to shift each character (default 3)
|
23
|
-
:param
|
24
|
-
:param key_iter: cipher key matrix (default (9, 4, 5, 7))
|
22
|
+
:param key: cipher key string (default "secret")
|
25
23
|
:param algorithm: main cipher algorithm name (default 'playfair')
|
26
24
|
"""
|
27
25
|
self._chars_replacements: dict = {}
|
28
26
|
self._text: str = text
|
29
27
|
self._shift: int = shift
|
30
28
|
self._multiplier: int = multiplier
|
31
|
-
self.
|
32
|
-
self._key_iter: iter = key_iter
|
29
|
+
self._key: str = key
|
33
30
|
self._algorithm_name: str = algorithm.lower()
|
34
31
|
self._algorithm = self._set_algorithm()
|
35
32
|
if text:
|
@@ -96,42 +93,23 @@ class PasswordGenerator:
|
|
96
93
|
self._multiplier = multiplier
|
97
94
|
|
98
95
|
@property
|
99
|
-
def
|
96
|
+
def key(self) -> str:
|
100
97
|
"""
|
101
98
|
Returns the key string for the cipher algorithm
|
102
99
|
Eg: ```key_str = pg.key_str```
|
103
100
|
:return: str: The key string for the cipher algorithm
|
104
101
|
"""
|
105
|
-
return self.
|
102
|
+
return self._key
|
106
103
|
|
107
|
-
@
|
108
|
-
def
|
104
|
+
@key.setter
|
105
|
+
def key(self, key: str) -> None:
|
109
106
|
"""
|
110
107
|
Sets the key string for the cipher algorithm
|
111
|
-
Eg: ```pg.
|
112
|
-
:param
|
108
|
+
Eg: ```pg.key = 'secret key'```
|
109
|
+
:param key: The key string for the cipher algorithm
|
113
110
|
:return:
|
114
111
|
"""
|
115
|
-
self.
|
116
|
-
|
117
|
-
@property
|
118
|
-
def key_iter(self) -> iter:
|
119
|
-
"""
|
120
|
-
Returns the key matrix for the cipher algorithm
|
121
|
-
Eg: ```key_iter = pg.key_iter```
|
122
|
-
:return: iter: The key matrix for the cipher algorithm
|
123
|
-
"""
|
124
|
-
return self._key_iter
|
125
|
-
|
126
|
-
@key_iter.setter
|
127
|
-
def key_iter(self, key_iter: iter) -> None:
|
128
|
-
"""
|
129
|
-
Sets the key matrix for the cipher algorithm
|
130
|
-
Eg: ```pg.key_iter = (9, 5, 2, 4)```
|
131
|
-
:param key_iter: The key matrix for the cipher algorithm
|
132
|
-
:return:
|
133
|
-
"""
|
134
|
-
self._key_iter = key_iter
|
112
|
+
self._key = key
|
135
113
|
|
136
114
|
@property
|
137
115
|
def algorithm(self) -> str:
|
@@ -173,9 +151,9 @@ class PasswordGenerator:
|
|
173
151
|
case 'affine':
|
174
152
|
return AffineCipher(self._multiplier, self._shift)
|
175
153
|
case 'playfair':
|
176
|
-
return PlayfairCipher(self.
|
154
|
+
return PlayfairCipher(self._key)
|
177
155
|
case 'hill':
|
178
|
-
return HillCipher(self.
|
156
|
+
return HillCipher(self._key)
|
179
157
|
case _:
|
180
158
|
raise InvalidAlgorithmException(self._algorithm_name)
|
181
159
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: passphera-core
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.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,6 +14,6 @@ Classifier: Topic :: Security
|
|
14
14
|
Classifier: Topic :: Security :: Cryptography
|
15
15
|
Description-Content-Type: text/markdown
|
16
16
|
|
17
|
-
# passphera-
|
17
|
+
# passphera-core
|
18
18
|
|
19
19
|
The core system of passphera project
|
@@ -0,0 +1,7 @@
|
|
1
|
+
passphera_core/__init__.py,sha256=ND2D_sTQk5mroNRsKm03PXhx0HNf0740hOtZ4_U98OQ,119
|
2
|
+
passphera_core/exceptions.py,sha256=PPZhy05QMVnN3mm6EGj-RgWanMaF3E6aKN4lcpNOJY8,158
|
3
|
+
passphera_core/generator.py,sha256=_OjRbToWw20nOOzBCc7kPg3DwCURK_HoTkI4Dyv7Rls,7036
|
4
|
+
passphera_core-0.4.0.dist-info/METADATA,sha256=9olDGxoeUkzJGImvwSVLwVW7bjUkXBiYwr7fC2vnfQg,628
|
5
|
+
passphera_core-0.4.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
passphera_core-0.4.0.dist-info/top_level.txt,sha256=aDUX2iWGOyfzyf6XakLWTbgeWqNrypMHO074Qratyds,15
|
7
|
+
passphera_core-0.4.0.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
passphera_core/__init__.py,sha256=zDJS1wcjyfEwO4YifFwghhWE3fM2pZNqodx8B4PkGDA,91
|
2
|
-
passphera_core/exceptions.py,sha256=M0wVUORrukx2wIkHAz42Sz4BMMY8JssZp7iuHaEjARc,155
|
3
|
-
passphera_core/generator.py,sha256=9Iz9ZCwYk4T0syefhErwWN5TentL2KGR_y7FjwB1l-A,7821
|
4
|
-
passphera_core-0.3.4.dist-info/METADATA,sha256=5GV9eRooBYFEtkMFrJR3mYFPenHct_eP4xJ8919D_so,627
|
5
|
-
passphera_core-0.3.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
passphera_core-0.3.4.dist-info/top_level.txt,sha256=aDUX2iWGOyfzyf6XakLWTbgeWqNrypMHO074Qratyds,15
|
7
|
-
passphera_core-0.3.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|