
'''simple docstring'''







class 			lowerCAmelCase :




		def __init__(				self      ):
								_SCREAMING_SNAKE_CASE				= ""
								_SCREAMING_SNAKE_CASE				= ""
								_SCREAMING_SNAKE_CASE				= []




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase      ):
								if m == -1:
														return n + 1
								elif n == -1:
														return m + 1
								elif self.dp[m][n] > -1:
														return self.dp[m][n]
								else:
														if self.worda[m] == self.worda[n]:
																				_SCREAMING_SNAKE_CASE				= self.__min_dist_top_down_dp(m - 1					,						n - 1      )
														else:
																				_SCREAMING_SNAKE_CASE				= self.__min_dist_top_down_dp(UpperCamelCase					,						n - 1      )
																				_SCREAMING_SNAKE_CASE				= self.__min_dist_top_down_dp(m - 1					,						UpperCamelCase      )
																				_SCREAMING_SNAKE_CASE				= self.__min_dist_top_down_dp(m - 1					,						n - 1      )
																				_SCREAMING_SNAKE_CASE				= 1 + min(UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase      )

														return self.dp[m][n]




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase      ):
								_SCREAMING_SNAKE_CASE				= worda
								_SCREAMING_SNAKE_CASE				= worda
								_SCREAMING_SNAKE_CASE				= [[-1 for _ in range(len(UpperCamelCase      )      )] for _ in range(len(UpperCamelCase      )      )]

								return self.__min_dist_top_down_dp(len(UpperCamelCase      ) - 1					,						len(UpperCamelCase      ) - 1      )




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase      ):
								_SCREAMING_SNAKE_CASE				= worda
								_SCREAMING_SNAKE_CASE				= worda
								_SCREAMING_SNAKE_CASE				= len(UpperCamelCase      )
								_SCREAMING_SNAKE_CASE				= len(UpperCamelCase      )
								_SCREAMING_SNAKE_CASE				= [[0 for _ in range(n + 1      )] for _ in range(m + 1      )]

								for i in range(m + 1      ):
														for j in range(n + 1      ):
																				if i == 0:  # first string is empty
																										_SCREAMING_SNAKE_CASE				= j
																				elif j == 0:  # second string is empty
																										_SCREAMING_SNAKE_CASE				= i
																				elif worda[i - 1] == worda[j - 1]:  # last characters are equal
																										_SCREAMING_SNAKE_CASE				= self.dp[i - 1][j - 1]
																				else:
																										_SCREAMING_SNAKE_CASE				= self.dp[i][j - 1]
																										_SCREAMING_SNAKE_CASE				= self.dp[i - 1][j]
																										_SCREAMING_SNAKE_CASE				= self.dp[i - 1][j - 1]
																										_SCREAMING_SNAKE_CASE				= 1 + min(UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase      )
								return self.dp[m][n]


if __name__ == "__main__":
						_snake_case				:   Dict     =				EditDistance()

						print("""****************** Testing Edit Distance DP Algorithm ******************""")
						print()

						_snake_case				:   List[str]     =				input("""Enter the first string: """).strip()
						_snake_case				:   List[Any]     =				input("""Enter the second string: """).strip()

						print()
						print(F"The minimum edit distance is: {solver.min_dist_top_down(Sa, Sa)}")
						print(F"The minimum edit distance is: {solver.min_dist_bottom_up(Sa, Sa)}")
						print()
						print("""*************** End of Testing Edit Distance DP Algorithm ***************""")

'''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 			_a		(	):
						print("Making key files..."  )
						make_key_files("rsa"	,			1024  )
						print("Key files generation successful."  )



def 			_a		(	_SCREAMING_SNAKE_CASE		:   int  ):
						print("Generating prime p..."  )
						_SCREAMING_SNAKE_CASE				= rabinMiller.generate_large_prime(_SCREAMING_SNAKE_CASE  )
						print("Generating prime q..."  )
						_SCREAMING_SNAKE_CASE				= rabinMiller.generate_large_prime(_SCREAMING_SNAKE_CASE  )
						_SCREAMING_SNAKE_CASE				= p * q

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

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

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



def 			_a		(	_SCREAMING_SNAKE_CASE		:   str	,			_SCREAMING_SNAKE_CASE		:   int  ):
						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()

						_SCREAMING_SNAKE_CASE,							_SCREAMING_SNAKE_CASE				= generate_key(_SCREAMING_SNAKE_CASE  )
						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()