


'''simple docstring'''






import os
import random
import sys

from . import cryptomath_module as cryptoMath  # noqa: N812
from . import rabin_miller as rabinMiller  # noqa: N812


def  _snake_case       (					)						->   None:
							print('''Making key files...'''	)
							make_key_files('''rsa'''			,   1024	)
							print('''Key files generation successful.'''	)


def  _snake_case       (					A	)						->   tuple[tuple[int, int], tuple[int, int]]:
							print('''Generating prime p...'''	)
							lowerCAmelCase__	       =     rabinMiller.generate_large_prime(A	)
							print('''Generating prime q...'''	)
							lowerCAmelCase__	       =     rabinMiller.generate_large_prime(A	)
							lowerCAmelCase__	       =     p * q

							print('''Generating e that is relatively prime to (p - 1) * (q - 1)...'''	)
							while True:
														lowerCAmelCase__	       =     random.randrange(2 ** (key_size - 1)			,   2 ** (key_size)	)
														if cryptoMath.gcd(A			,   (p - 1) * (q - 1)	) == 1:
																					break

							print('''Calculating d that is mod inverse of e...'''	)
							lowerCAmelCase__	       =     cryptoMath.find_mod_inverse(A			,   (p - 1) * (q - 1)	)

							lowerCAmelCase__	       =     (n, e)
							lowerCAmelCase__	       =     (n, d)
							return (public_key, private_key)


def  _snake_case       (					A			,   A	)						->   None:
							if os.path.exists(F"""{name}_pubkey.txt"""	) or os.path.exists(F"""{name}_privkey.txt"""	):
														print('''\nWARNING:'''	)
														print(
														    F"""\"{name}_pubkey.txt\" or \"{name}_privkey.txt\" already exists. \n"""
														    '''Use a different name or delete these files and re-run this program.'''	)
														sys.exit()

							lowerCAmelCase__       , lowerCAmelCase__	       =     generate_key(A	)
							print(F"""\nWriting public key to file {name}_pubkey.txt..."""	)
							with open(F"""{name}_pubkey.txt"""			,   '''w'''	) as out_file:
														out_file.write(F"""{key_size},{public_key[0]},{public_key[1]}"""	)

							print(F"""Writing private key to file {name}_privkey.txt..."""	)
							with open(F"""{name}_privkey.txt"""			,   '''w'''	) as out_file:
														out_file.write(F"""{key_size},{private_key[0]},{private_key[1]}"""	)


if __name__ == "__main__":
		main()



'''simple docstring'''






from __future__ import annotations


def  _snake_case       (					A			,   A	)						->   float:
							lowerCAmelCase__	       =     sorted(numsa + numsa	)
							lowerCAmelCase__       , lowerCAmelCase__	       =     divmod(len(A	)			,   2	)
							if mod == 1:
														return all_numbers[div]
							else:
														return (all_numbers[div] + all_numbers[div - 1]) / 2


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		__UpperCAmelCase       =							[float(x) for x in input('''Enter the elements of first array: ''').split()]
		__UpperCAmelCase       =							[float(x) for x in input('''Enter the elements of second array: ''').split()]
		print(f"""The median of two arrays is: {median_of_two_arrays(array_a, array_a)}""")