
'''simple docstring'''





import os
import sys
import time

from . import transposition_cipher as trans_cipher

def   snake_case_       (							):
      snake_case_						       =							"Prehistoric Men.txt"
      snake_case_						       =							"Output.txt"
      snake_case_						       =							int(input("Enter key: "			)			)
      snake_case_						       =							input("Encrypt/Decrypt [e/d]: "			)

      if not os.path.exists(_UpperCamelCase			):
            print(F'''File {input_file} does not exist. Quitting...'''			)
            sys.exit()
      if os.path.exists(_UpperCamelCase			):
            print(F'''Overwrite {output_file}? [y/n]'''			)
            snake_case_						       =							input("> "			)
            if not response.lower().startswith("y"			):
                  sys.exit()

      snake_case_						       =							time.time()
      if mode.lower().startswith("e"			):
            with open(_UpperCamelCase			) as f:
                  snake_case_						       =							f.read()
            snake_case_						       =							trans_cipher.encrypt_message(_UpperCamelCase ,					_UpperCamelCase			)
      elif mode.lower().startswith("d"			):
            with open(_UpperCamelCase			) as f:
                  snake_case_						       =							f.read()
            snake_case_						       =							trans_cipher.decrypt_message(_UpperCamelCase ,					_UpperCamelCase			)

      with open(_UpperCamelCase ,					"w"			) as output_obj:
            output_obj.write(_UpperCamelCase			)

      snake_case_						       =							round(time.time() - start_time ,					2			)
      print(("Done (", total_time, "seconds )")			)


if __name__ == "__main__":
     main()



'''simple docstring'''





def   snake_case_       (							_a     :							List[str] ,					_a     :							List[str]			):
      snake_case_						       =							1
      while b > 0:
            if b & 1:
                  res *= a

            a *= a
            b >>= 1

      return res
def   snake_case_       (							_a     :							Union[str, Any] ,					_a     :							Tuple ,					_a     :							Optional[Any]			):
      snake_case_						       =							1
      while b > 0:
            if b & 1:
                  snake_case_						       =							((res % c) * (a % c)) % c

            a *= a
            b >>= 1

      return res

