
'''simple docstring'''

from __future__ import annotations

import random
import string







class 	__lowerCAmelCase    :



     def __init__(self						,	lowerCAmelCase__ = None	):
          _UpperCAmelCase					:  str         =    passcode or self.__passcode_creator()
          _UpperCAmelCase					:  Union[str, Any]         =    self.__make_key_list()
          _UpperCAmelCase					:  Optional[int]         =    self.__make_shift_key()



     def __str__(self	):
          return "".join(self.__passcode	)



     def     snake_case_ (self						,	lowerCAmelCase__	):
          for i in range(1						,	len(lowerCAmelCase__	)						,	2	):
               iterlist[i] *= -1
          return iterlist



     def     snake_case_ (self	):
          _UpperCAmelCase					:  Any         =    string.ascii_letters + string.digits
          _UpperCAmelCase					:  Tuple         =    [random.choice(lowerCAmelCase__	) for _ in range(random.randint(1_0						,	2_0	)	)]
          return password



     def     snake_case_ (self	):
          _UpperCAmelCase					:  Union[str, Any]         =    (
              string.ascii_letters + string.digits + string.punctuation + """ \t\n"""
          )

          _UpperCAmelCase					:  Any         =    []

          # creates points known as breakpoints to break the key_list_options at those
          # points and pivot each substring
          _UpperCAmelCase					:  Optional[Any]         =    sorted(set(self.__passcode	)	)
          _UpperCAmelCase					:  list[str]         =    []

          # algorithm for creating a new shuffled list, keys_l, out of key_list_options
          for i in key_list_options:
               temp_list.extend(lowerCAmelCase__	)

               # checking breakpoints at which to pivot temporary sublist and add it into
               # keys_l
               if i in breakpoints or i == key_list_options[-1]:
                    keys_l.extend(temp_list[::-1]	)
                    temp_list.clear()

        # returning a shuffled keys_l to prevent brute force guessing of shift key
          return keys_l



     def     snake_case_ (self	):
          _UpperCAmelCase					:  Dict         =    sum(self.__neg_pos([ord(lowerCAmelCase__	) for x in self.__passcode]	)	)
          return num if num > 0 else len(self.__passcode	)



     def     snake_case_ (self						,	lowerCAmelCase__	):
          _UpperCAmelCase					:  Tuple         =    """"""

          # decoding shift like Caesar cipher algorithm implementing negative shift or
          # reverse shift or left shift
          for i in encoded_message:
               _UpperCAmelCase					:  str         =    self.__key_list.index(lowerCAmelCase__	)
               decoded_message += self.__key_list[
                   (position - self.__shift_key) % -len(self.__key_list	)
               ]

          return decoded_message



     def     snake_case_ (self						,	lowerCAmelCase__	):
          _UpperCAmelCase					:  str         =    """"""

          # encoding shift like Caesar cipher algorithm implementing positive shift or
          # forward shift or right shift
          for i in plaintext:
               _UpperCAmelCase					:  Union[str, Any]         =    self.__key_list.index(lowerCAmelCase__	)
               encoded_message += self.__key_list[
                   (position + self.__shift_key) % len(self.__key_list	)
               ]

          return encoded_message







def __A  (    lowerCAmelCase_ = "Hello, this is a modified Caesar cipher"       ):
     _UpperCAmelCase					:  Union[str, Any]         =    ShuffledShiftCipher()
     return cipa.decrypt(cipa.encrypt(lowerCAmelCase_       )       )


if __name__ == "__main__":
   import doctest

   doctest.testmod()









from typing import Literal

UpperCamelCase__          ='ABCDEFGHIJKLMNOPQRSTUVWXYZ'






def 			lowerCamelCase__	(__lowerCamelCase,				__lowerCamelCase,				__lowerCamelCase		):
     _SCREAMING_SNAKE_CASE				:		Tuple  			=							LETTERS if mode == "decrypt" else key
     _SCREAMING_SNAKE_CASE				:		Tuple  			=							key if mode == "decrypt" else LETTERS
     _SCREAMING_SNAKE_CASE				:		Dict  			=							""
     # loop through each symbol in the message
     for symbol in message:
          if symbol.upper() in chars_a:
               # encrypt/decrypt the symbol
               _SCREAMING_SNAKE_CASE				:		List[str]  			=							chars_a.find(symbol.upper()		)
               if symbol.isupper():
                    translated += chars_b[sym_index].upper()
               else:
                    translated += chars_b[sym_index].lower()
          else:
               # symbol is not in LETTERS, just add it
               translated += symbol
     return translated






def 			lowerCamelCase__	(__lowerCamelCase,				__lowerCamelCase		):
     return translate_message(__lowerCamelCase,				__lowerCamelCase,				"encrypt"		)






def 			lowerCamelCase__	(__lowerCamelCase,				__lowerCamelCase		):
     return translate_message(__lowerCamelCase,				__lowerCamelCase,				"decrypt"		)






def 			lowerCamelCase__	():
     _SCREAMING_SNAKE_CASE				:		str  			=							"Hello World"
     _SCREAMING_SNAKE_CASE				:		List[str]  			=							"QWERTYUIOPASDFGHJKLZXCVBNM"
     _SCREAMING_SNAKE_CASE				:		Any  			=							"decrypt"  # set to 'encrypt' or 'decrypt'

     if mode == "encrypt":
          _SCREAMING_SNAKE_CASE				:		int  			=							encrypt_message(__lowerCamelCase,				__lowerCamelCase		)
     elif mode == "decrypt":
          _SCREAMING_SNAKE_CASE				:		Optional[int]  			=							decrypt_message(__lowerCamelCase,				__lowerCamelCase		)
     print(f"""Using the key {key}, the {mode}ed message is: {translated}"""		)


if __name__ == "__main__":
       import doctest

       doctest.testmod()
       main()