diff --git a/MyCaesarCipher/main.py b/MyCaesarCipher/main.py index ac2dc48..910bf20 100644 --- a/MyCaesarCipher/main.py +++ b/MyCaesarCipher/main.py @@ -25,6 +25,7 @@ def encrypt(text: str, - Generates encrypted form of :param:`text` using the Caesar-Cipher algorithm. - If no :param:`key` is provided, a random integer value is generated. + - Optionally disable output of encrypted text results to stdout by toggling :param:`stdout_output` to `False`. --- @@ -63,7 +64,7 @@ def encrypt(text: str, else: output += char - info: str = f'> Original Msg : {text}\n\n\t- Shift-key : {key}\n\n\t- Encrypted Result: {output}\n' + info: str = f'> Original Msg : {text}\n\n> Shift-key : {key}\n\n> Encrypted Result: {output}\n' if stdout_output: print(info) @@ -74,7 +75,7 @@ def encrypt(text: str, def decrypt(text: str, stdout_output: bool = True) -> dict[str, int]: """Decrypt Caesar-Cipher encrypted messages and return dictionary of all possible results. - - Optionally disable output of all decrypted text and corresponding shift-keys by toggling :param:`stdout_output` to `False`. + - Optionally disable output of decrypted text results and corresponding shift-keys to stdout by toggling :param:`stdout_output` to `False`. --- diff --git a/README.md b/README.md index dc35298..90afc6d 100644 --- a/README.md +++ b/README.md @@ -75,12 +75,16 @@ >>> msg = 'Test Cipher' >>> cipher.encrypt(text=msg, key=200, stdout_output=True) + ------------------------------------ + > Original Msg : Test Cipher - - Shift-Key : 200 - - Encrypted Result: Lwkl Uahzwj + + > Shift-Key : 200 + + > Encrypted Result: Lwkl Uahzwj ``` -- Therefore the final encrypted result of "Test Cipher" using a shift-key of 200 is: +- Therefore the final encrypted result of "Test Cipher" using a shift key of 200 is: - "**`LwklfUahzwj`**". @@ -89,21 +93,41 @@ - ```python >>> cipher.encrypt('Test Cipher', stdout_output=True) + ------------------------------------ + > Original Msg : Test Cipher - - Shift-key : 19 - - Encrypted Result: Mxlm Vbiaxk + > Shift-key : 19 + + > Encrypted Result: Mxlm Vbiaxk + ``` + + --- + + - ```python >>> cipher.encrypt('Test Cipher', stdout_output=True) + ------------------------------------ + > Original Msg : Test Cipher - - Shift-key : 24 - - Encrypted Result: Rcqr Agnfcp + > Shift-key : 24 + + > Encrypted Result: Rcqr Agnfcp + ``` + + --- + + - ```python >>> cipher.encrypt('Test Cipher', stdout_output=True) + ------------------------------------ + > Original Msg : Test Cipher - - Shift-key : 4 - - Encrypted Result: Xiwx Gmtliv + + > Shift-key : 4 + + > Encrypted Result: Xiwx Gmtliv ``` --- @@ -116,10 +140,9 @@ >>> from MyCaesarCipher import CaesarCipher >>> cipher = CaesarCipher() # Create new class instance. - >>> code = 'Ozno Xdkczm' - >>> decryption = cipher.decrypt(text=code, stdout_output=True) + >>> decryption = cipher.decrypt(text='Ozno Xdkczm', stdout_output=True) - >>> print(decryption) + ------------------------------------ > Decrypted Shift-Key 0 : Ozno Xdkczm