
def  lowerCAmelCase__			(  SCREAMING_SNAKE_CASE_       ,							SCREAMING_SNAKE_CASE_     )				->		int:
			while a != 0:
						lowerCAmelCase__      ,				lowerCAmelCase__      :      Tuple         =		b % a, a
			return b







def  lowerCAmelCase__			(  SCREAMING_SNAKE_CASE_       ,							SCREAMING_SNAKE_CASE_     )				->		int:
			if gcd(SCREAMING_SNAKE_CASE_       ,							SCREAMING_SNAKE_CASE_     ) != 1:
						lowerCAmelCase__      :      Any         =		F'''mod inverse of {a!r} and {m!r} does not exist'''
						raise ValueError(SCREAMING_SNAKE_CASE_     )
			lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      :      Optional[Any]         =		1, 0, a
			lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      :      Optional[int]         =		0, 1, m
			while va != 0:
						lowerCAmelCase__      :      Union[str, Any]         =		ua // va
						lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      :      int         =		(ua - q * va), (ua - q * va), (ua - q * va), va, va, va
			return ua % m

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







class      A__							:






				def __init__(						self					:      Dict    ,     a					:      str   ):






							'''simple docstring'''







							lowerCAmelCase__      :      Optional[int]         =		data
							lowerCAmelCase__      :      List[Any]         =		[0X67_452_301, 0Xef_cda_b89, 0X98_bad_cfe, 0X10_325_476, 0Xc3_d2e_1f0]






				@staticmethod
				def 							_lowerCamelCase		(						a					:      int    ,     a					:      List[str]   ):






							'''simple docstring'''







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






				def 							_lowerCamelCase		(						self					:      Optional[int]   ):






							'''simple docstring'''







							lowerCAmelCase__      :      Any         =		b'\x80' + b'\x00' * (63 - (len(self.data   ) + 8) % 64)
							lowerCAmelCase__      :      List[str]         =		self.data + padding + struct.pack('>Q'    ,     8 * len(self.data   )   )
							return padded_data






				def 							_lowerCamelCase		(						self					:      Tuple   ):






							'''simple docstring'''







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






				def 							_lowerCamelCase		(						self					:      Tuple    ,     a					:      List[Any]   ):






							'''simple docstring'''







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






				def 							_lowerCamelCase		(						self					:      Dict   ):






							'''simple docstring'''







							lowerCAmelCase__      :      Optional[Any]         =		self.padding()
							lowerCAmelCase__      :      List[Any]         =		self.split_blocks()
							for block in self.blocks:
										lowerCAmelCase__      :      str         =		self.expand_block(a   )
										lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      :      str         =		self.h
										for i in range(0    ,     80   ):
													if 0 <= i < 20:
																lowerCAmelCase__      :      Tuple         =		(b & c) | ((~b) & d)
																lowerCAmelCase__      :      int         =		0X5a_827_999
													elif 20 <= i < 40:
																lowerCAmelCase__      :      List[str]         =		b ^ c ^ d
																lowerCAmelCase__      :      Any         =		0X6e_d9e_ba1
													elif 40 <= i < 60:
																lowerCAmelCase__      :      Tuple         =		(b & c) | (b & d) | (c & d)
																lowerCAmelCase__      :      Tuple         =		0X8f_1bb_cdc
													elif 60 <= i < 80:
																lowerCAmelCase__      :      List[Any]         =		b ^ c ^ d
																lowerCAmelCase__      :      int         =		0Xca_62c_1d6
													lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      ,				lowerCAmelCase__      :      Dict         =		(
													    self.rotate(a    ,     5   ) + f + e + k + expanded_block[i] & 0Xff_fff_fff,
													    a,
													    self.rotate(a    ,     30   ),
													    c,
													    d,
													)
										lowerCAmelCase__      :      Optional[Any]         =		(
										    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  lowerCAmelCase__			(  )				->		Tuple:
			lowerCAmelCase__      :      Optional[int]         =		b'Test String'
			assert SHAaHash(SCREAMING_SNAKE_CASE_     ).final_hash() == hashlib.shaa(SCREAMING_SNAKE_CASE_     ).hexdigest()  # noqa: S324
def  lowerCAmelCase__			(  )				->		Any:
			lowerCAmelCase__      :      str         =		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__      :      Dict         =		parser.parse_args()
			lowerCAmelCase__      :      Tuple         =		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__      :      List[Any]         =		f.read()
			else:
						lowerCAmelCase__      :      Tuple         =		bytes(SCREAMING_SNAKE_CASE_       ,							'utf-8'     )
			print(SHAaHash(SCREAMING_SNAKE_CASE_     ).final_hash()     )


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

					doctest.testmod()