


import os
import random
import sys

from . import cryptomath_module as cryptomath
from . import rabin_miller

_SCREAMING_SNAKE_CASE      :			Any      				=   3
def       UpperCAmelCase__						(UpperCamelCase_    ):



     """simple docstring"""






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



     """simple docstring"""






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

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

     return public_key, private_key
def       UpperCAmelCase__						(UpperCamelCase_							,UpperCamelCase_    ):



     """simple docstring"""






     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			,  snake_case					=    generate_key(UpperCamelCase_    )
     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       UpperCAmelCase__						():



     """simple docstring"""






     print('''Making key files...'''    )
     make_key_files('''elgamal'''							,20_48    )
     print('''Key files generation successful'''    )


if __name__ == "__main__":
 main()








from collections import OrderedDict
from typing import List, Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


_SCREAMING_SNAKE_CASE      :			List[str]      				=   logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE      :			Optional[int]      				=   {
    "google/efficientnet-b7": "https://huggingface.co/google/efficientnet-b7/resolve/main/config.json",
}

class   A__ (   snake_case__     ):







    """simple docstring"""

    __magic_name__        =		'efficientnet'
    def __init__(	self      , __snake_case = 3      , __snake_case = 6_0_0      , __snake_case = 2.0      , __snake_case = 3.1      , __snake_case = 8      , __snake_case = [3, 3, 5, 3, 5, 5, 3]      , __snake_case = [3_2, 1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2]      , __snake_case = [1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2, 3_2_0]      , __snake_case = []      , __snake_case = [1, 2, 2, 2, 1, 2, 1]      , __snake_case = [1, 2, 2, 3, 3, 4, 1]      , __snake_case = [1, 6, 6, 6, 6, 6, 6]      , __snake_case = 0.25      , __snake_case = "swish"      , __snake_case = 2_5_6_0      , __snake_case = "mean"      , __snake_case = 0.02      , __snake_case = 0.001      , __snake_case = 0.99      , __snake_case = 0.5      , __snake_case = 0.2      , **__snake_case      , ):
         super().__init__(**__snake_case   )

         snake_case					=    num_channels
         snake_case					=    image_size
         snake_case					=    width_coefficient
         snake_case					=    depth_coefficient
         snake_case					=    depth_divisor
         snake_case					=    kernel_sizes
         snake_case					=    in_channels
         snake_case					=    out_channels
         snake_case					=    depthwise_padding
         snake_case					=    strides
         snake_case					=    num_block_repeats
         snake_case					=    expand_ratios
         snake_case					=    squeeze_expansion_ratio
         snake_case					=    hidden_act
         snake_case					=    hidden_dim
         snake_case					=    pooling_type
         snake_case					=    initializer_range
         snake_case					=    batch_norm_eps
         snake_case					=    batch_norm_momentum
         snake_case					=    dropout_rate
         snake_case					=    drop_connect_rate
         snake_case					=    sum(__snake_case   ) * 4






class   A__ (   snake_case__     ):







    """simple docstring"""

    __magic_name__        =		version.parse('1.11'     )
    @property
    def 		a_      (	self   ):
         return OrderedDict(
             [
                 ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
             ]   )




    @property
    def 		a_      (	self   ):
         return 1E-5




