






'''simple docstring'''



import argparse
import struct
import unittest
class 							__SCREAMING_SNAKE_CASE       :




      def __init__(  self ,   lowerCamelCase      )							->None:



         '''simple docstring'''
         __a				     =    data

         # Initialize hash values
         __a				     =    [
             0x6a09e667,
             0xbb67ae85,
             0x3c6ef372,
             0xa54ff53a,
             0x510e527f,
             0x9b05688c,
             0x1f83d9ab,
             0x5be0cd19,
         ]

         # Initialize round constants
         __a				     =    [
             0x428a2f98,
             0x71374491,
             0xb5c0fbcf,
             0xe9b5dba5,
             0x3956c25b,
             0x59f111f1,
             0x923f82a4,
             0xab1c5ed5,
             0xd807aa98,
             0x12835b01,
             0x243185be,
             0x550c7dc3,
             0x72be5d74,
             0x80deb1fe,
             0x9bdc06a7,
             0xc19bf174,
             0xe49b69c1,
             0xefbe4786,
             0x0fc19dc6,
             0x240ca1cc,
             0x2de92c6f,
             0x4a7484aa,
             0x5cb0a9dc,
             0x76f988da,
             0x983e5152,
             0xa831c66d,
             0xb00327c8,
             0xbf597fc7,
             0xc6e00bf3,
             0xd5a79147,
             0x06ca6351,
             0x14292967,
             0x27b70a85,
             0x2e1b2138,
             0x4d2c6dfc,
             0x53380d13,
             0x650a7354,
             0x766a0abb,
             0x81c2c92e,
             0x92722c85,
             0xa2bfe8a1,
             0xa81a664b,
             0xc24b8b70,
             0xc76c51a3,
             0xd192e819,
             0xd6990624,
             0xf40e3585,
             0x106aa070,
             0x19a4c116,
             0x1e376c08,
             0x2748774c,
             0x34b0bcb5,
             0x391c0cb3,
             0x4ed8aa4a,
             0x5b9cca4f,
             0x682e6ff3,
             0x748f82ee,
             0x78a5636f,
             0x84c87814,
             0x8cc70208,
             0x90befffa,
             0xa4506ceb,
             0xbef9a3f7,
             0xc67178f2,
         ]

         __a				     =    self.preprocessing(self.data      )
         self.final_hash()




      @staticmethod
      def  __UpperCamelCase							(  lowerCamelCase      )							->bytes:



         '''simple docstring'''
         __a				     =    B'\x80' + (B'\x00' * (63 - (len(lowerCamelCase      ) + 8) % 64))
         __a				     =    struct.pack('>Q' ,   (len(lowerCamelCase      ) * 8)      )
         return data + padding + big_endian_integer




      def  __UpperCamelCase							(  self      )							->None:



         '''simple docstring'''
         __a				     =    [
             self.preprocessed_data[x : x + 64]
             for x in range(0 ,   len(self.preprocessed_data      ) ,   64      )
         ]

         for block in self.blocks:
            # Convert the given block into a list of 4 byte integers
            __a				     =    list(struct.unpack('>16L' ,   lowerCamelCase      )      )
            # add 48 0-ed integers
            words += [0] * 48

            __a     ,			__a     ,			__a     ,			__a     ,			__a     ,			__a     ,			__a     ,			__a				     =    self.hashes

            for index in range(0 ,   64      ):
               if index > 15:
                  # modify the zero-ed indexes at the end of the array
                  __a				     =    (
                      self.ror(words[index - 15] ,   7      )
                      ^ self.ror(words[index - 15] ,   18      )
                      ^ (words[index - 15] >> 3)
                  )
                  __a				     =    (
                      self.ror(words[index - 2] ,   17      )
                      ^ self.ror(words[index - 2] ,   19      )
                      ^ (words[index - 2] >> 10)
                  )

                  __a				     =    (
                      words[index - 16] + sa + words[index - 7] + sa
                  ) % 0x100000000

               # Compression
               __a				     =    self.ror(lowerCamelCase ,   6      ) ^ self.ror(lowerCamelCase ,   11      ) ^ self.ror(lowerCamelCase ,   25      )
               __a				     =    (e & f) ^ ((~e & 0xffffffff) & g)
               __a				     =    (
                   h + sa + ch + self.round_constants[index] + words[index]
               ) % 0x100000000
               __a				     =    self.ror(lowerCamelCase ,   2      ) ^ self.ror(lowerCamelCase ,   13      ) ^ self.ror(lowerCamelCase ,   22      )
               __a				     =    (a & b) ^ (a & c) ^ (b & c)
               __a				     =    (sa + maj) % 0x100000000

               __a     ,			__a     ,			__a     ,			__a     ,			__a     ,			__a     ,			__a     ,			__a				     =    (
                   g,
                   f,
                   e,
                   ((d + tempa) % 0x100000000),
                   c,
                   b,
                   a,
                   ((tempa + tempa) % 0x100000000),
               )

            __a				     =    [a, b, c, d, e, f, g, h]

            # Modify final values
            __a				     =    [
                ((element + mutated_hash_values[index]) % 0x100000000)
                for index, element in enumerate(self.hashes      )
            ]

         __a				     =    ''.join([hex(lowerCamelCase      )[2:].zfill(8      ) for value in self.hashes]      )






      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase      )							->int:



         '''simple docstring'''
         return 0xffffffff & (value << (32 - rotations)) | (value >> rotations)







class 							__SCREAMING_SNAKE_CASE       (							unittest.TestCase     ):




      def  __UpperCamelCase							(  self      )							->None:



         '''simple docstring'''
         import hashlib

         __a				     =    bytes('Test String' ,   'utf-8'      )
         self.assertEqual(SHAaaa(lowerCamelCase      ).hash ,   hashlib.shaaaa(lowerCamelCase      ).hexdigest()      )







def    __UpperCAmelCase	(				)  ->			None:

   """simple docstring"""
   import doctest

   doctest.testmod()

   __a				     =    argparse.ArgumentParser()
   parser.add_argument(
       '-s',					'--string',					dest='input_string',					default='Hello World!! Welcome to Cryptography',					help='Hash the string',					)
   parser.add_argument(
       '-f',					'--file',					dest='input_file',					help='Hash contents of a file'    )

   __a				     =    parser.parse_args()

   __a				     =    args.input_string

   # hash input should be a bytestring
   if args.input_file:
      with open(args.input_file,					'rb'    ) as f:
         __a				     =    f.read()
   else:
      __a				     =    bytes(SCREAMING_SNAKE_CASE__,					'utf-8'    )

   print(SHAaaa(SCREAMING_SNAKE_CASE__    ).hash    )


if __name__ == "__main__":
 main()








'''simple docstring'''



from collections import OrderedDict
from typing import Mapping

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


__UpperCamelCase      :       Dict      			=      logging.get_logger(__name__)

__UpperCamelCase      :       Optional[int]      			=      {
    """facebook/xmod-base""": """https://huggingface.co/facebook/xmod-base/resolve/main/config.json""",
    """facebook/xmod-large-prenorm""": """https://huggingface.co/facebook/xmod-large-prenorm/resolve/main/config.json""",
    """facebook/xmod-base-13-125k""": """https://huggingface.co/facebook/xmod-base-13-125k/resolve/main/config.json""",
    """facebook/xmod-base-30-125k""": """https://huggingface.co/facebook/xmod-base-30-125k/resolve/main/config.json""",
    """facebook/xmod-base-30-195k""": """https://huggingface.co/facebook/xmod-base-30-195k/resolve/main/config.json""",
    """facebook/xmod-base-60-125k""": """https://huggingface.co/facebook/xmod-base-60-125k/resolve/main/config.json""",
    """facebook/xmod-base-60-265k""": """https://huggingface.co/facebook/xmod-base-60-265k/resolve/main/config.json""",
    """facebook/xmod-base-75-125k""": """https://huggingface.co/facebook/xmod-base-75-125k/resolve/main/config.json""",
    """facebook/xmod-base-75-269k""": """https://huggingface.co/facebook/xmod-base-75-269k/resolve/main/config.json""",
}
class 							__SCREAMING_SNAKE_CASE       (							_lowerCAmelCase     ):
      __a  					="xmod"




      def __init__(  self ,   lowerCamelCase=3_0522 ,   lowerCamelCase=768 ,   lowerCamelCase=12 ,   lowerCamelCase=12 ,   lowerCamelCase=3072 ,   lowerCamelCase="gelu" ,   lowerCamelCase=0.1 ,   lowerCamelCase=0.1 ,   lowerCamelCase=512 ,   lowerCamelCase=2 ,   lowerCamelCase=0.02 ,   lowerCamelCase=1e-12 ,   lowerCamelCase=1 ,   lowerCamelCase=0 ,   lowerCamelCase=2 ,   lowerCamelCase="absolute" ,   lowerCamelCase=True ,   lowerCamelCase=None ,   lowerCamelCase=False ,   lowerCamelCase=2 ,   lowerCamelCase=False ,   lowerCamelCase=True ,   lowerCamelCase=True ,   lowerCamelCase=("en_XX",) ,   lowerCamelCase=None ,   **lowerCamelCase ,   )							->Any:



         '''simple docstring'''
         super().__init__(pad_token_id=lowerCamelCase ,   bos_token_id=lowerCamelCase ,   eos_token_id=lowerCamelCase ,   **lowerCamelCase      )

         __a				     =    vocab_size
         __a				     =    hidden_size
         __a				     =    num_hidden_layers
         __a				     =    num_attention_heads
         __a				     =    hidden_act
         __a				     =    intermediate_size
         __a				     =    hidden_dropout_prob
         __a				     =    attention_probs_dropout_prob
         __a				     =    max_position_embeddings
         __a				     =    type_vocab_size
         __a				     =    initializer_range
         __a				     =    layer_norm_eps
         __a				     =    position_embedding_type
         __a				     =    use_cache
         __a				     =    classifier_dropout
         __a				     =    pre_norm
         __a				     =    adapter_reduction_factor
         __a				     =    adapter_layer_norm
         __a				     =    adapter_reuse_layer_norm
         __a				     =    ln_before_adapter
         __a				     =    list(lowerCamelCase      )
         __a				     =    default_language







class 							__SCREAMING_SNAKE_CASE       (							_lowerCAmelCase     ):




      @property
      def  __UpperCamelCase							(  self      )							->Mapping[str, Mapping[int, str]]:



         '''simple docstring'''
         if self.task == "multiple-choice":
            __a				     =    {0: 'batch', 1: 'choice', 2: 'sequence'}
         else:
            __a				     =    {0: 'batch', 1: 'sequence'}
         return OrderedDict(
             [
                 ('input_ids', dynamic_axis),
                 ('attention_mask', dynamic_axis),
             ]      )