
'''simple docstring'''

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






class  A  :





	def __init__(       self      :							Optional[Any]   ,				__magic_name__      :							Any				):


				"""simple docstring"""

				lowerCAmelCase__										=				data
				lowerCAmelCase__										=				[0X6745_2301, 0XEFCD_AB89, 0X98BA_DCFE, 0X1032_5476, 0XC3D2_E1F0]





	@staticmethod
	def 				__SCREAMING_SNAKE_CASE	(       __magic_name__      :							Optional[int]   ,				__magic_name__      :							str				):


				"""simple docstring"""

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





	def 				__SCREAMING_SNAKE_CASE	(       self      :							int				):


				"""simple docstring"""

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





	def 				__SCREAMING_SNAKE_CASE	(       self      :							List[str]				):


				"""simple docstring"""

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





	def 				__SCREAMING_SNAKE_CASE	(       self      :							Any   ,				__magic_name__      :							Union[str, Any]				):


				"""simple docstring"""

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







	def 				__SCREAMING_SNAKE_CASE	(       self      :							Union[str, Any]				):


				"""simple docstring"""

				lowerCAmelCase__										=				self.padding()
				lowerCAmelCase__										=				self.split_blocks()
				for block in self.blocks:
							lowerCAmelCase__										=				self.expand_block(__magic_name__				)
							lowerCAmelCase__						,lowerCAmelCase__						,lowerCAmelCase__						,lowerCAmelCase__						,lowerCAmelCase__										=				self.h
							for i in range(0   ,				80				):
										if 0 <= i < 20:
													lowerCAmelCase__										=				(b & c) | ((~b) & d)
													lowerCAmelCase__										=				0X5A82_7999
										elif 20 <= i < 40:
													lowerCAmelCase__										=				b ^ c ^ d
													lowerCAmelCase__										=				0X6ED9_EBA1
										elif 40 <= i < 60:
													lowerCAmelCase__										=				(b & c) | (b & d) | (c & d)
													lowerCAmelCase__										=				0X8F1B_BCDC
										elif 60 <= i < 80:
													lowerCAmelCase__										=				b ^ c ^ d
													lowerCAmelCase__										=				0XCA62_C1D6
										lowerCAmelCase__						,lowerCAmelCase__						,lowerCAmelCase__						,lowerCAmelCase__						,lowerCAmelCase__										=				(
										    self.rotate(__magic_name__   ,				5				) + f + e + k + expanded_block[i] & 0XFFFF_FFFF,
										    a,
										    self.rotate(__magic_name__   ,				30				),
										    c,
										    d,
										)
							lowerCAmelCase__										=				(
							    self.h[0] + a & 0XFFFF_FFFF,
							    self.h[1] + b & 0XFFFF_FFFF,
							    self.h[2] + c & 0XFFFF_FFFF,
							    self.h[3] + d & 0XFFFF_FFFF,
							    self.h[4] + e & 0XFFFF_FFFF,
							)
				return ("{:08x}" * 5).format(*self.h				)







def 	A  (   )       ->							int:







			'''simple docstring'''



			lowerCAmelCase__										=				B"Test String"
			assert SHAaHash(UpperCamelCase_   ).final_hash() == hashlib.shaa(UpperCamelCase_   ).hexdigest()  # noqa: S324







def 	A  (   )       ->							Dict:







			'''simple docstring'''



			lowerCAmelCase__										=				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"   )
			lowerCAmelCase__										=				parser.parse_args()
			lowerCAmelCase__										=				args.input_string
			# In any case hash input should be a bytestring
			if args.input_file:
						with open(args.input_file    ,						"rb"   ) as f:
									lowerCAmelCase__										=				f.read()
			else:
						lowerCAmelCase__										=				bytes(UpperCamelCase_    ,						"utf-8"   )
			print(SHAaHash(UpperCamelCase_   ).final_hash()   )


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

		doctest.testmod()










'''simple docstring'''





from ...configuration_utils import PretrainedConfig
from ...utils import logging


A__    :   Optional[Any]           =					logging.get_logger(__name__)

A__    :   List[str]           =					{
    '''microsoft/cvt-13''': '''https://huggingface.co/microsoft/cvt-13/resolve/main/config.json''',
    # See all Cvt models at https://huggingface.co/models?filter=cvt
}



class  snake_case__						(    SCREAMING_SNAKE_CASE_				):
 A__				= '''cvt'''
 def __init__(   self						:							Optional[Any]      ,     __a						:							Union[str, Any]=3      ,     __a						:							List[Any]=[7, 3, 3]      ,     __a						:							Optional[int]=[4, 2, 2]      ,     __a						:							Dict=[2, 1, 1]      ,     __a						:							Union[str, Any]=[64, 192, 384]      ,     __a						:							int=[1, 3, 6]      ,     __a						:							List[str]=[1, 2, 10]      ,     __a						:							Optional[Any]=[4.0, 4.0, 4.0]      ,     __a						:							Any=[0.0, 0.0, 0.0]      ,     __a						:							List[str]=[0.0, 0.0, 0.0]      ,     __a						:							List[Any]=[0.0, 0.0, 0.1]      ,     __a						:							List[str]=[True, True, True]      ,     __a						:							int=[False, False, True]      ,     __a						:							Dict=["dw_bn", "dw_bn", "dw_bn"]      ,     __a						:							List[str]=[3, 3, 3]      ,     __a						:							Union[str, Any]=[1, 1, 1]      ,     __a						:							Optional[int]=[2, 2, 2]      ,     __a						:							Optional[Any]=[1, 1, 1]      ,     __a						:							List[str]=[1, 1, 1]      ,     __a						:							List[str]=0.0_2      ,     __a						:							List[str]=1e-12      ,     **__a						:							List[str]      ,     )      ->   Dict:







       '''simple docstring'''
       super().__init__(**__a  )
       __snake_case :   int													=    num_channels
       __snake_case :   Union[str, Any]													=    patch_sizes
       __snake_case :   Any													=    patch_stride
       __snake_case :   List[str]													=    patch_padding
       __snake_case :   Optional[Any]													=    embed_dim
       __snake_case :   Union[str, Any]													=    num_heads
       __snake_case :   Dict													=    depth
       __snake_case :   Optional[Any]													=    mlp_ratio
       __snake_case :   List[str]													=    attention_drop_rate
       __snake_case :   Optional[int]													=    drop_rate
       __snake_case :   Optional[int]													=    drop_path_rate
       __snake_case :   Any													=    qkv_bias
       __snake_case :   int													=    cls_token
       __snake_case :   Optional[int]													=    qkv_projection_method
       __snake_case :   List[Any]													=    kernel_qkv
       __snake_case :   List[Any]													=    padding_kv
       __snake_case :   int													=    stride_kv
       __snake_case :   List[str]													=    padding_q
       __snake_case :   Dict													=    stride_q
       __snake_case :   Tuple													=    initializer_range
       __snake_case :   List[Any]													=    layer_norm_eps



