





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





def       lowercase_      (		lowercase__						)   ->tuple[tuple[int, int], tuple[int, int]]:
						print('Generating prime p...'						)
						_snake_case:   Any  					=		rabinMiller.generate_large_prime(lowercase__						)
						print('Generating prime q...'						)
						_snake_case:   List[Any]  					=		rabinMiller.generate_large_prime(lowercase__						)
						_snake_case:   List[str]  					=		p * q

						print('Generating e that is relatively prime to (p - 1) * (q - 1)...'						)
						while True:
												_snake_case:   List[Any]  					=		random.randrange(2 ** (key_size - 1)				,  2 ** (key_size)						)
												if cryptoMath.gcd(lowercase__				,  (p - 1) * (q - 1)						) == 1:
																		break

						print('Calculating d that is mod inverse of e...'						)
						_snake_case:   Union[str, Any]  					=		cryptoMath.find_mod_inverse(lowercase__				,  (p - 1) * (q - 1)						)

						_snake_case:   Optional[Any]  					=		(n, e)
						_snake_case:   str  					=		(n, d)
						return (public_key, private_key)





def       lowercase_      (		lowercase__				,  lowercase__						)   ->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()

						_snake_case:   Dict  					=		generate_key(lowercase__						)
						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'''






A   : List[str]             =			'\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n'

A   : List[str]             =			[{'type': 'code', 'content': INSTALL_CONTENT}]
A   : Dict             =			{
    '{processor_class}': 'FakeProcessorClass',
    '{model_class}': 'FakeModelClass',
    '{object_class}': 'FakeObjectClass',
}





