





'''simple docstring'''

from __future__ import annotations

import math
import random





def lowerCamelCase						(					__lowerCamelCase			:   int ,	__lowerCamelCase			:   int ,	__lowerCamelCase			:   int   )						->list[int]:
    _SCREAMING_SNAKE_CASE     =      d * e - 1
    _SCREAMING_SNAKE_CASE     =      0
    _SCREAMING_SNAKE_CASE     =      0
    while p == 0:
        _SCREAMING_SNAKE_CASE     =      random.randint(2 ,	n - 1   )
        _SCREAMING_SNAKE_CASE     =      k
        while True:
            if t % 2 == 0:
                _SCREAMING_SNAKE_CASE     =      t // 2
                _SCREAMING_SNAKE_CASE     =      (g**t) % n
                _SCREAMING_SNAKE_CASE     =      math.gcd(x - 1 ,	__lowerCamelCase   )
                if x > 1 and y > 1:
                    _SCREAMING_SNAKE_CASE     =      y
                    _SCREAMING_SNAKE_CASE     =      n // y
                    break  # find the correct factors
            else:
                break  # t is not divisible by 2, break and choose another g
    return sorted([p, q]   )


if __name__ == "__main__":
      import doctest

      doctest.testmod()










'''simple docstring'''

import os
import sys
import time

from . import transposition_cipher as trans_cipher





def lowerCamelCase						(					)						->None:
    _SCREAMING_SNAKE_CASE     =      """Prehistoric Men.txt"""
    _SCREAMING_SNAKE_CASE     =      """Output.txt"""
    _SCREAMING_SNAKE_CASE     =      int(input("""Enter key: """   )   )
    _SCREAMING_SNAKE_CASE     =      input("""Encrypt/Decrypt [e/d]: """   )

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

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

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

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


if __name__ == "__main__":
      main()



