passphera-core 0.31.0__tar.gz → 0.32.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.31.0 → passphera_core-0.32.0}/PKG-INFO +1 -1
- {passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core/entities.py +5 -7
- {passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core/utilities.py +2 -2
- {passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core.egg-info/PKG-INFO +1 -1
- {passphera_core-0.31.0 → passphera_core-0.32.0}/setup.py +1 -1
- {passphera_core-0.31.0 → passphera_core-0.32.0}/README.md +0 -0
- {passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core/__init__.py +0 -0
- {passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core/exceptions.py +0 -0
- {passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core.egg-info/SOURCES.txt +0 -0
- {passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core.egg-info/dependency_links.txt +0 -0
- {passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core.egg-info/requires.txt +0 -0
- {passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core.egg-info/top_level.txt +0 -0
- {passphera_core-0.31.0 → passphera_core-0.32.0}/setup.cfg +0 -0
@@ -12,7 +12,7 @@ _cipher_registry: dict = {
|
|
12
12
|
'playfair': PlayfairCipherAlgorithm,
|
13
13
|
'hill': HillCipherAlgorithm,
|
14
14
|
}
|
15
|
-
_default_properties: dict[str,
|
15
|
+
_default_properties: dict[str, object] = {
|
16
16
|
"shift": 3,
|
17
17
|
"multiplier": 3,
|
18
18
|
"key": "hill",
|
@@ -97,7 +97,6 @@ class Generator:
|
|
97
97
|
setattr(self, prop, value)
|
98
98
|
if prop == "algorithm":
|
99
99
|
self.get_algorithm()
|
100
|
-
self.updated_at = datetime.now(timezone.utc)
|
101
100
|
|
102
101
|
@check_property_name
|
103
102
|
def reset_property(self, prop: str) -> None:
|
@@ -110,7 +109,6 @@ class Generator:
|
|
110
109
|
setattr(self, prop, _default_properties[prop])
|
111
110
|
if prop == "algorithm":
|
112
111
|
self.get_algorithm()
|
113
|
-
self.updated_at = datetime.now(timezone.utc)
|
114
112
|
|
115
113
|
def get_character_replacement(self, character: str) -> str:
|
116
114
|
"""
|
@@ -129,7 +127,6 @@ class Generator:
|
|
129
127
|
:return: None
|
130
128
|
"""
|
131
129
|
self.characters_replacements[character[0]] = replacement
|
132
|
-
self.updated_at = datetime.now(timezone.utc)
|
133
130
|
|
134
131
|
def reset_character_replacement(self, character: str) -> None:
|
135
132
|
"""
|
@@ -138,7 +135,6 @@ class Generator:
|
|
138
135
|
:return: None
|
139
136
|
"""
|
140
137
|
self.characters_replacements.pop(character, None)
|
141
|
-
self.updated_at = datetime.now(timezone.utc)
|
142
138
|
|
143
139
|
def generate_password(self, text: str) -> str:
|
144
140
|
"""
|
@@ -150,7 +146,8 @@ class Generator:
|
|
150
146
|
secondary_algorithm: AffineCipherAlgorithm = AffineCipherAlgorithm(self.shift, self.multiplier)
|
151
147
|
intermediate: str = secondary_algorithm.encrypt(f"{self.prefix}{text}{self.postfix}")
|
152
148
|
password: str = main_algorithm.encrypt(intermediate)
|
153
|
-
|
149
|
+
for char, repl in self.characters_replacements.items():
|
150
|
+
password = password.replace(char, repl)
|
154
151
|
return ''.join(c.upper() if c in text else c for c in password)
|
155
152
|
|
156
153
|
def to_dict(self) -> dict:
|
@@ -168,4 +165,5 @@ class Generator:
|
|
168
165
|
def from_dict(self, data: dict) -> None:
|
169
166
|
"""Convert a dictionary to a Generator entity."""
|
170
167
|
for key, value in data.items():
|
171
|
-
|
168
|
+
if key in _default_properties or key == "characters_replacements":
|
169
|
+
setattr(self, key, value)
|
@@ -2,8 +2,8 @@ from passphera_core.exceptions import InvalidPropertyNameException
|
|
2
2
|
|
3
3
|
|
4
4
|
def check_property_name(func):
|
5
|
-
def wrapper(self, prop,
|
5
|
+
def wrapper(self, prop, *args, **kwargs):
|
6
6
|
if prop not in {"shift", "multiplier", "key", "algorithm", "prefix", "postfix", "character_replacements"}:
|
7
7
|
raise InvalidPropertyNameException(prop)
|
8
|
-
return func(self, prop,
|
8
|
+
return func(self, prop, *args, **kwargs)
|
9
9
|
return wrapper
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{passphera_core-0.31.0 → passphera_core-0.32.0}/passphera_core.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|