






import argparse
import hashlib  # hashlib is only used inside the Test class
import struct






class 						lowercase_   :






      '''simple docstring'''




      def __init__( self :		Optional[int]					,   __UpperCAmelCase :		Tuple    )       ->str:




       """simple docstring"""


       a						    = data
       a						    = [0x67_452_301, 0xef_cda_b89, 0x98_bad_cfe, 0x10_325_476, 0xc3_d2e_1f0]







      @staticmethod
      def  __lowerCAmelCase   ( __UpperCAmelCase :		Tuple					,   __UpperCAmelCase :		Tuple    )       ->Dict:




       """simple docstring"""


       return ((n << b) | (n >> (32 - b))) & 0xff_fff_fff







      def  __lowerCAmelCase   ( self :		int    )       ->Union[str, Any]:




       """simple docstring"""


       a						    = b'''\x80''' + b'''\x00''' * (63 - (len(self.data    ) + 8) % 64)
       a						    = self.data + padding + struct.pack('''>Q'''					,   8 * len(self.data    )    )
       return padded_data







      def  __lowerCAmelCase   ( self :		str    )       ->Optional[Any]:




       """simple docstring"""


       return [
           self.padded_data[i : i + 64] for i in range(0					,   len(self.padded_data    )					,   64    )
       ]







      def  __lowerCAmelCase   ( self :		Dict					,   __UpperCAmelCase :		List[Any]    )       ->int:




       """simple docstring"""


       a						    = list(struct.unpack('''>16L'''					,   __UpperCAmelCase    )    ) + [0] * 64
       for i in range(16					,   80    ):
        a						    = self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16])					,   1    )
       return w







      def  __lowerCAmelCase   ( self :		int    )       ->List[Any]:




       """simple docstring"""


       a						    = self.padding()
       a						    = self.split_blocks()
       for block in self.blocks:
        a						    = self.expand_block(__UpperCAmelCase    )
        a    ,	a    ,	a    ,	a    ,	a						    = self.h
        for i in range(0					,   80    ):
         if 0 <= i < 20:
          a						    = (b & c) | ((~b) & d)
          a						    = 0x5a_827_999
         elif 20 <= i < 40:
          a						    = b ^ c ^ d
          a						    = 0x6e_d9e_ba1
         elif 40 <= i < 60:
          a						    = (b & c) | (b & d) | (c & d)
          a						    = 0x8f_1bb_cdc
         elif 60 <= i < 80:
          a						    = b ^ c ^ d
          a						    = 0xca_62c_1d6
         a    ,	a    ,	a    ,	a    ,	a						    = (
             self.rotate(__UpperCAmelCase					,   5    ) + f + e + k + expanded_block[i] & 0xff_fff_fff,
             a,
             self.rotate(__UpperCAmelCase					,   30    ),
             c,
             d,
         )
        a						    = (
            self.h[0] + a & 0xff_fff_fff,
            self.h[1] + b & 0xff_fff_fff,
            self.h[2] + c & 0xff_fff_fff,
            self.h[3] + d & 0xff_fff_fff,
            self.h[4] + e & 0xff_fff_fff,
        )
       return ("{:08x}" * 5).format(*self.h    )
def 		_a       ( )				->     Dict:
 a						    = B'''Test String'''
 assert SHAaHash(a					).final_hash() == hashlib.shaa(a					).hexdigest()  # noqa: S324
def 		_a       ( )				->     Optional[Any]:
 a						    = argparse.ArgumentParser(description='''Process some strings or files'''					)
 parser.add_argument(
     '''--string'''      ,				dest='''input_string'''      ,				default='''Hello World!! Welcome to Cryptography'''      ,				help='''Hash the string'''      ,				)
 parser.add_argument('''--file'''      ,				dest='''input_file'''      ,				help='''Hash contents of a file'''					)
 a						    = parser.parse_args()
 a						    = args.input_string
 # In any case hash input should be a bytestring
 if args.input_file:
  with open(args.input_file      ,				'''rb'''					) as f:
   a						    = f.read()
 else:
  a						    = bytes(a      ,				'''utf-8'''					)
 print(SHAaHash(a					).final_hash()					)


if __name__ == "__main__":
     main()
     import doctest

     doctest.testmod()










from ... import PretrainedConfig


UpperCAmelCase__							  =						{
    "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json",
}






class 						lowercase_   (      lowercase  ):






      '''simple docstring'''




      __snake_case	    =    NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP
      __snake_case	    =    '''nezha'''







      def __init__( self :		Union[str, Any]					,   __UpperCAmelCase :		List[str]=21_128					,   __UpperCAmelCase :		Any=768					,   __UpperCAmelCase :		int=12					,   __UpperCAmelCase :		Optional[int]=12					,   __UpperCAmelCase :		Tuple=3_072					,   __UpperCAmelCase :		Union[str, Any]="gelu"					,   __UpperCAmelCase :		List[str]=0.1					,   __UpperCAmelCase :		Any=0.1					,   __UpperCAmelCase :		str=512					,   __UpperCAmelCase :		List[Any]=64					,   __UpperCAmelCase :		Tuple=2					,   __UpperCAmelCase :		List[Any]=0.02					,   __UpperCAmelCase :		List[str]=1e-1_2					,   __UpperCAmelCase :		int=0.1					,   __UpperCAmelCase :		Dict=0					,   __UpperCAmelCase :		Any=2					,   __UpperCAmelCase :		Optional[Any]=3					,   __UpperCAmelCase :		int=True					,   **__UpperCAmelCase :		Optional[Any]					,   )       ->Any:




       """simple docstring"""


       super().__init__(pad_token_id=__UpperCAmelCase					,   bos_token_id=__UpperCAmelCase					,   eos_token_id=__UpperCAmelCase					,   **__UpperCAmelCase    )

       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						    = max_relative_position
       a						    = type_vocab_size
       a						    = initializer_range
       a						    = layer_norm_eps
       a						    = classifier_dropout
       a						    = use_cache


