





'''simple docstring'''
from .data_collator import (
    DataCollatorForLanguageModeling,
    DataCollatorForPermutationLanguageModeling,
    DataCollatorForSeqaSeq,
    DataCollatorForSOP,
    DataCollatorForTokenClassification,
    DataCollatorForWholeWordMask,
    DataCollatorWithPadding,
    DefaultDataCollator,
    default_data_collator,
)
from .metrics import glue_compute_metrics, xnli_compute_metrics
from .processors import (
    DataProcessor,
    InputExample,
    InputFeatures,
    SingleSentenceClassificationProcessor,
    SquadExample,
    SquadFeatures,
    SquadVaProcessor,
    SquadVaProcessor,
    glue_convert_examples_to_features,
    glue_output_modes,
    glue_processors,
    glue_tasks_num_labels,
    squad_convert_examples_to_features,
    xnli_output_modes,
    xnli_processors,
    xnli_tasks_num_labels,
)




import os
import random
import sys

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






def 							__lowercase   ( ):
							print('Making key files...'   )
							make_key_files('rsa'					,    1_0_2_4   )
							print('Key files generation successful.'   )






def 							__lowercase   ( __lowerCAmelCase							:				int   ):
							print('Generating prime p...'   )
							a__             =     rabinMiller.generate_large_prime(__lowerCAmelCase   )
							print('Generating prime q...'   )
							a__             =     rabinMiller.generate_large_prime(__lowerCAmelCase   )
							a__             =     p * q

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

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

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






def 							__lowercase   ( __lowerCAmelCase							:				str					,    __lowerCAmelCase							:				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()

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




