


import os
import random
import sys

from . import cryptomath_module as cryptomath
from . import rabin_miller

snake_case_						:			int													=							3







def 						lowerCamelCase(   a__):
				print('''Generating primitive root of p''')
				while True:
								_SCREAMING_SNAKE_CASE			  =random.randrange(3	,a__)
								if pow(a__	,2	,a__) == 1:
												continue
								if pow(a__	,a__	,a__) == 1:
												continue
								return g







def 						lowerCamelCase(   a__):
				print('''Generating prime p...''')
				_SCREAMING_SNAKE_CASE			  =rabin_miller.generate_large_prime(a__)  # select large prime number.
				_SCREAMING_SNAKE_CASE			  =primitive_root(a__)  # one primitive root on modulo p.
				_SCREAMING_SNAKE_CASE			  =random.randrange(3	,a__)  # private_key -> have to be greater than 2 for safety.
				_SCREAMING_SNAKE_CASE			  =cryptomath.find_mod_inverse(pow(a__	,a__	,a__)	,a__)

				_SCREAMING_SNAKE_CASE			  =(key_size, e_a, e_a, p)
				_SCREAMING_SNAKE_CASE			  =(key_size, d)

				return public_key, private_key







def 						lowerCamelCase(   a__	,a__):
				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(a__)
				print(f"\nWriting public key to file {name}_pubkey.txt...")
				with open(f"{name}_pubkey.txt"	,'''w''') as fo:
								fo.write(f"{public_key[0]},{public_key[1]},{public_key[2]},{public_key[3]}")

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







def 						lowerCamelCase(   ):
				print('''Making key files...''')
				make_key_files('''elgamal'''	,2048)
				print('''Key files generation successful''')


if __name__ == "__main__":
							main()



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available


snake_case_						:			Optional[Any]													=							{
    '''configuration_audio_spectrogram_transformer''': [
        '''AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''ASTConfig''',
    ]
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							snake_case_						:			Optional[Any]													=							[
							    '''AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''ASTForAudioClassification''',
							    '''ASTModel''',
							    '''ASTPreTrainedModel''',
							]

try:
							if not is_speech_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							snake_case_						:			List[Any]													=							['''ASTFeatureExtractor''']

if TYPE_CHECKING:
							from .configuration_audio_spectrogram_transformer import (
							    AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    ASTConfig,
							)

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_audio_spectrogram_transformer import (
														    AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
														    ASTForAudioClassification,
														    ASTModel,
														    ASTPreTrainedModel,
														)

							try:
														if not is_speech_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .feature_extraction_audio_spectrogram_transformer import ASTFeatureExtractor


else:
							import sys

							snake_case_						:			Optional[Any]													=							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)