




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


class    lowerCamelCase :






			'''simple docstring'''





			def __init__( self			:   Dict       ,						lowerCamelCase_			:   Union[str, Any]  )						->   List[str]:
								__magic_name__							:	List[Any]    							=							data
								__magic_name__							:	Union[str, Any]    							=							[0X67452301, 0XEFCDAB89, 0X98BADCFE, 0X10325476, 0XC3D2E1F0]

			@staticmethod
			def 							UpperCAmelCase__       ( lowerCamelCase_			:   Tuple       ,						lowerCamelCase_			:   List[Any]  )						->   Optional[Any]:
								return ((n << b) | (n >> (32 - b))) & 0XFFFFFFFF

			def 							UpperCAmelCase__       ( self			:   Optional[int]  )						->   Dict:
								__magic_name__							:	List[Any]    							=							b"""\x80""" + b"""\x00""" * (63 - (len(self.data  ) + 8) % 64)
								__magic_name__							:	Tuple    							=							self.data + padding + struct.pack('''>Q'''       ,						8 * len(self.data  )  )
								return padded_data

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

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


			def 							UpperCAmelCase__       ( self			:   Union[str, Any]  )						->   Dict:
								__magic_name__							:	List[str]    							=							self.padding()
								__magic_name__							:	Union[str, Any]    							=							self.split_blocks()
								for block in self.blocks:
													__magic_name__							:	int    							=							self.expand_block(lowerCamelCase_  )
													__magic_name__							:	Optional[int]    							=							self.h
													for i in range(0       ,						80  ):
																		if 0 <= i < 20:
																							__magic_name__							:	Any    							=							(b & c) | ((~b) & d)
																							__magic_name__							:	List[str]    							=							0X5A827999
																		elif 20 <= i < 40:
																							__magic_name__							:	str    							=							b ^ c ^ d
																							__magic_name__							:	Tuple    							=							0X6ED9EBA1
																		elif 40 <= i < 60:
																							__magic_name__							:	Tuple    							=							(b & c) | (b & d) | (c & d)
																							__magic_name__							:	Optional[int]    							=							0X8F1BBCDC
																		elif 60 <= i < 80:
																							__magic_name__							:	Dict    							=							b ^ c ^ d
																							__magic_name__							:	List[str]    							=							0XCA62C1D6
																		__magic_name__							:	str    							=							(
																		    self.rotate(lowerCamelCase_       ,						5  ) + f + e + k + expanded_block[i] & 0XFFFFFFFF,
																		    a,
																		    self.rotate(lowerCamelCase_       ,						30  ),
																		    c,
																		    d,
																		)
													__magic_name__							:	Any    							=							(
													    self.h[0] + a & 0XFFFFFFFF,
													    self.h[1] + b & 0XFFFFFFFF,
													    self.h[2] + c & 0XFFFFFFFF,
													    self.h[3] + d & 0XFFFFFFFF,
													    self.h[4] + e & 0XFFFFFFFF,
													)
								return ("{:08x}" * 5).format(*self.h  )







def 		lowercase__   (		):





					'''simple docstring'''






					__magic_name__							:	List[str]    							=							B"""Test String"""
					assert SHAaHash(lowerCamelCase_				).final_hash() == hashlib.shaa(lowerCamelCase_				).hexdigest()  # noqa: S324







def 		lowercase__   (		):





					'''simple docstring'''






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


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

	doctest.testmod()









import functools







def 		lowercase__   (		__A:	list[int]							,__A:	list[int]				):





					'''simple docstring'''






					if not isinstance(__A							,__A				) or not all(isinstance(__A							,__A				) for day in days				):
										raise ValueError('''The parameter days should be a list of integers'''				)

					if len(__A				) != 3 or not all(isinstance(__A							,__A				) for cost in costs				):
										raise ValueError('''The parameter costs should be a list of three integers'''				)

					if len(__A				) == 0:
										return 0

					if min(__A				) <= 0:
										raise ValueError('''All days elements should be greater than 0'''				)

					if max(__A				) >= 3_6_6:
										raise ValueError('''All days elements should be less than 366'''				)

					__magic_name__							:	Tuple    							=							set(__A				)

					@functools.cache
					def dynamic_programming(__A:	int				) -> int:
										if index > 3_6_5:
															return 0

										if index not in days_set:
															return dynamic_programming(index + 1				)

										return min(
										    costs[0] + dynamic_programming(index + 1				)							,costs[1] + dynamic_programming(index + 7				)							,costs[2] + dynamic_programming(index + 3_0				)							,)

					return dynamic_programming(1				)


if __name__ == "__main__":
	import doctest

	doctest.testmod()



