


"""simple docstring"""




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




class 			__snake_case   :




							def __init__(     self:    str     ,							A_:    Optional[Any]   ):
										__lowerCamelCase          =      data
										__lowerCamelCase          =      [0X6745_2301, 0XEFCD_AB89, 0X98BA_DCFE, 0X1032_5476, 0XC3D2_E1F0]




							@staticmethod
							def   __a   (     A_:    int     ,							A_:    List[Any]   ):
										return ((n << b) | (n >> (32 - b))) & 0XFFFF_FFFF




							def   __a   (     self:    Optional[int]   ):
										__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   __a   (     self:    Tuple   ):
										return [
										    self.padded_data[i : i + 64] for i in range(0     ,							len(self.padded_data   )     ,							64   )
										]




							def   __a   (     self:    Dict     ,							A_:    Union[str, Any]   ):
										__lowerCamelCase          =      list(struct.unpack(""">16L"""     ,							A_   )   ) + [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   __a   (     self:    str   ):
										__lowerCamelCase          =      self.padding()
										__lowerCamelCase          =      self.split_blocks()
										for block in self.blocks:
													__lowerCamelCase          =      self.expand_block(A_   )
													__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(A_     ,							5   ) + f + e + k + expanded_block[i] & 0XFFFF_FFFF,
																    a,
																    self.rotate(A_     ,							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_ (	):
			__lowerCamelCase          =      B"""Test String"""
			assert SHAaHash(lowercase__     ).final_hash() == hashlib.shaa(lowercase__     ).hexdigest()  # noqa: S324





def       a_ (	):
			__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(lowercase__,			"""utf-8"""     )
			print(SHAaHash(lowercase__     ).final_hash()     )


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

					doctest.testmod()








"""simple docstring"""




from __future__ import annotations





def       a_ (	lowercase__ :list[float]     ):
			if len(lowercase__     ) < 2:
						raise ValueError("""Monogons and Digons are not polygons in the Euclidean space"""     )
			if any(i <= 0 for i in nums     ):
						raise ValueError("""All values must be greater than 0"""     )
			__lowerCamelCase          =      nums.copy()
			copy_nums.sort()
			return copy_nums[-1] < sum(copy_nums[:-1]     )


if __name__ == "__main__":
					import doctest

					doctest.testmod()




