





'''simple docstring'''




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






class 				__snake_case     :





	def __init__(		self      ,       UpperCamelCase_		)      ->		List[Any]:
		snake_case__	       =   data
		snake_case__	       =   [0X67_452_301, 0XEF_CDA_B89, 0X98_BAD_CFE, 0X10_325_476, 0XC3_D2E_1F0]





	@staticmethod
	def   _snake_case   (		UpperCamelCase_      ,       UpperCamelCase_		)      ->		Tuple:
		return ((n << b) | (n >> (32 - b))) & 0XFF_FFF_FFF





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





	def   _snake_case   (		self		)      ->		Union[str, Any]:
		return [
		    self.padded_data[i : i + 64] for i in range(0      ,       len(self.padded_data		)      ,       64		)
		]





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





	def   _snake_case   (		self		)      ->		Tuple:
		snake_case__	       =   self.padding()
		snake_case__	       =   self.split_blocks()
		for block in self.blocks:
			snake_case__	       =   self.expand_block(UpperCamelCase_		)
			snake_case__       ,  snake_case__       ,  snake_case__       ,  snake_case__       ,  snake_case__	       =   self.h
			for i in range(0      ,       80		):
				if 0 <= i < 20:
					snake_case__	       =   (b & c) | ((~b) & d)
					snake_case__	       =   0X5A_827_999
				elif 20 <= i < 40:
					snake_case__	       =   b ^ c ^ d
					snake_case__	       =   0X6E_D9E_BA1
				elif 40 <= i < 60:
					snake_case__	       =   (b & c) | (b & d) | (c & d)
					snake_case__	       =   0X8F_1BB_CDC
				elif 60 <= i < 80:
					snake_case__	       =   b ^ c ^ d
					snake_case__	       =   0XCA_62C_1D6
				snake_case__       ,  snake_case__       ,  snake_case__       ,  snake_case__       ,  snake_case__	       =   (
				    self.rotate(UpperCamelCase_      ,       5		) + f + e + k + expanded_block[i] & 0XFF_FFF_FFF,
				    a,
				    self.rotate(UpperCamelCase_      ,       30		),
				    c,
				    d,
				)
			snake_case__	       =   (
			    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			(	)   ->str:
	snake_case__	       =   B'Test String'
	assert SHAaHash(UpperCAmelCase_							).final_hash() == hashlib.shaa(UpperCAmelCase_							).hexdigest()  # noqa: S324




def 						__lowerCamelCase			(	)   ->Optional[int]:
	snake_case__	       =   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'							)
	snake_case__	       =   parser.parse_args()
	snake_case__	       =   args.input_string
	# In any case hash input should be a bytestring
	if args.input_file:
		with open(args.input_file					,				'rb'							) as f:
			snake_case__	       =   f.read()
	else:
		snake_case__	       =   bytes(UpperCAmelCase_					,				'utf-8'							)
	print(SHAaHash(UpperCAmelCase_							).final_hash()							)


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

			doctest.testmod()










'''simple docstring'''




import cmath
import math




def 						__lowerCamelCase			(	UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_							)   ->complex:
	snake_case__	       =   math.radians(UpperCAmelCase_							)
	snake_case__	       =   math.radians(UpperCAmelCase_							)

	# Convert voltage and current to rectangular form
	snake_case__	       =   cmath.rect(UpperCAmelCase_					,				UpperCAmelCase_							)
	snake_case__	       =   cmath.rect(UpperCAmelCase_					,				UpperCAmelCase_							)

	# Calculate apparent power
	return voltage_rect * current_rect


if __name__ == "__main__":
			import doctest

			doctest.testmod()



