passphera-core 0.4.0__tar.gz → 0.5.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.4.0 → passphera-core-0.5.0}/PKG-INFO +1 -1
- {passphera-core-0.4.0 → passphera-core-0.5.0}/passphera_core/generator.py +14 -10
- {passphera-core-0.4.0 → passphera-core-0.5.0}/passphera_core.egg-info/PKG-INFO +1 -1
- {passphera-core-0.4.0 → passphera-core-0.5.0}/setup.py +1 -1
- {passphera-core-0.4.0 → passphera-core-0.5.0}/README.md +0 -0
- {passphera-core-0.4.0 → passphera-core-0.5.0}/passphera_core/__init__.py +0 -0
- {passphera-core-0.4.0 → passphera-core-0.5.0}/passphera_core/exceptions.py +0 -0
- {passphera-core-0.4.0 → passphera-core-0.5.0}/passphera_core.egg-info/SOURCES.txt +0 -0
- {passphera-core-0.4.0 → passphera-core-0.5.0}/passphera_core.egg-info/dependency_links.txt +0 -0
- {passphera-core-0.4.0 → passphera-core-0.5.0}/passphera_core.egg-info/top_level.txt +0 -0
- {passphera-core-0.4.0 → passphera-core-0.5.0}/setup.cfg +0 -0
| @@ -9,26 +9,30 @@ class PasswordGenerator: | |
| 9 9 | 
             
                """
         | 
| 10 10 | 
             
                def __init__(
         | 
| 11 11 | 
             
                        self,
         | 
| 12 | 
            -
                        text: str = None,
         | 
| 13 12 | 
             
                        shift: int = 3,
         | 
| 14 13 | 
             
                        multiplier: int = 3,
         | 
| 15 14 | 
             
                        key: str = "hill",
         | 
| 16 | 
            -
                        algorithm: str = 'hill'
         | 
| 15 | 
            +
                        algorithm: str = 'hill',
         | 
| 16 | 
            +
                        characters_replacements: dict = None,
         | 
| 17 | 
            +
                        text: str = None,
         | 
| 17 18 | 
             
                ):
         | 
| 18 19 | 
             
                    """
         | 
| 19 | 
            -
                    :param text: plain text to be ciphered
         | 
| 20 20 | 
             
                    :param shift: number of characters to shift each character (default 3)
         | 
| 21 21 | 
             
                    :param multiplier: number of characters to shift each character (default 3)
         | 
| 22 22 | 
             
                    :param key: cipher key string (default "secret")
         | 
| 23 23 | 
             
                    :param algorithm: main cipher algorithm name (default 'playfair')
         | 
| 24 | 
            +
                    :param characters_replacements: replace characters with the given values (default {})
         | 
| 25 | 
            +
                    :param text: plain text to be ciphered
         | 
| 24 26 | 
             
                    """
         | 
| 25 | 
            -
                     | 
| 26 | 
            -
             | 
| 27 | 
            +
                    if characters_replacements is None:
         | 
| 28 | 
            +
                        characters_replacements = {}
         | 
| 27 29 | 
             
                    self._shift: int = shift
         | 
| 28 30 | 
             
                    self._multiplier: int = multiplier
         | 
| 29 31 | 
             
                    self._key: str = key
         | 
| 30 32 | 
             
                    self._algorithm_name: str = algorithm.lower()
         | 
| 31 33 | 
             
                    self._algorithm = self._set_algorithm()
         | 
| 34 | 
            +
                    self._characters_replacements: dict = characters_replacements
         | 
| 35 | 
            +
                    self._text: str = text
         | 
| 32 36 | 
             
                    if text:
         | 
| 33 37 | 
             
                        self._password: str = f"secret{self._text.replace(' ', '')}secret"
         | 
| 34 38 | 
             
                    else:
         | 
| @@ -138,7 +142,7 @@ class PasswordGenerator: | |
| 138 142 | 
             
                    Eg: ```print(pg.characters_replacements)  # {'a': '@1', 'b': '#2'}```
         | 
| 139 143 | 
             
                    :return: dict: The dictionary of the characters replacements
         | 
| 140 144 | 
             
                    """
         | 
| 141 | 
            -
                    return self. | 
| 145 | 
            +
                    return self._characters_replacements
         | 
| 142 146 |  | 
| 143 147 | 
             
                def _set_algorithm(self):
         | 
| 144 148 | 
             
                    """
         | 
| @@ -171,7 +175,7 @@ class PasswordGenerator: | |
| 171 175 | 
             
                    :param replacement: The (character|set of characters) to replace the first one
         | 
| 172 176 | 
             
                    :return:
         | 
| 173 177 | 
             
                    """
         | 
| 174 | 
            -
                    self. | 
| 178 | 
            +
                    self._characters_replacements[char[0]] = replacement
         | 
| 175 179 |  | 
| 176 180 | 
             
                def reset_character(self, char: str) -> None:
         | 
| 177 181 | 
             
                    """
         | 
| @@ -179,8 +183,8 @@ class PasswordGenerator: | |
| 179 183 | 
             
                    :param char: The character to be reset to its original value
         | 
| 180 184 | 
             
                    :return:
         | 
| 181 185 | 
             
                    """
         | 
| 182 | 
            -
                    if char in self. | 
| 183 | 
            -
                        del self. | 
| 186 | 
            +
                    if char in self._characters_replacements:
         | 
| 187 | 
            +
                        del self._characters_replacements[char]
         | 
| 184 188 |  | 
| 185 189 | 
             
                def generate_raw_password(self) -> str:
         | 
| 186 190 | 
             
                    """
         | 
| @@ -203,6 +207,6 @@ class PasswordGenerator: | |
| 203 207 | 
             
                    for char in self._password:
         | 
| 204 208 | 
             
                        if char in self._text:
         | 
| 205 209 | 
             
                            self._password = self._password.replace(char, char.upper())
         | 
| 206 | 
            -
                    for char, replacement in self. | 
| 210 | 
            +
                    for char, replacement in self._characters_replacements.items():
         | 
| 207 211 | 
             
                        self._password = self._password.replace(char, replacement)
         | 
| 208 212 | 
             
                    return self._password
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         |