






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







    def __init__(						self       ,					__lowerCAmelCase     ):
        """simple docstring"""
        __magic_name__		:Optional[int]        =      data
        __magic_name__		:Optional[Any]        =      [0X6745_2301, 0XEFCD_AB89, 0X98BA_DCFE, 0X1032_5476, 0XC3D2_E1F0]







    @staticmethod
    def 			A	(						__lowerCAmelCase       ,					__lowerCAmelCase     ):
        """simple docstring"""
        return ((n << b) | (n >> (3_2 - b))) & 0XFFFF_FFFF







    def 			A	(						self     ):
        """simple docstring"""
        __magic_name__		:str        =      B"""\x80""" + B"""\x00""" * (6_3 - (len(self.data     ) + 8) % 6_4)
        __magic_name__		:Union[str, Any]        =      self.data + padding + struct.pack('''>Q'''       ,					8 * len(self.data     )     )
        return padded_data







    def 			A	(						self     ):
        """simple docstring"""
        return [
            self.padded_data[i : i + 6_4] for i in range(0       ,					len(self.padded_data     )       ,					6_4     )
        ]







    def 			A	(						self       ,					__lowerCAmelCase     ):
        """simple docstring"""
        __magic_name__		:Optional[Any]        =      list(struct.unpack('''>16L'''       ,					_a     )     ) + [0] * 6_4
        for i in range(1_6       ,					8_0     ):
            __magic_name__		:List[str]        =      self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 1_4] ^ w[i - 1_6])       ,					1     )
        return w







    def 			A	(						self     ):
        """simple docstring"""
        __magic_name__		:Optional[int]        =      self.padding()
        __magic_name__		:Union[str, Any]        =      self.split_blocks()
        for block in self.blocks:
            __magic_name__		:Tuple        =      self.expand_block(_a     )
            __magic_name__		:str        =      self.h
            for i in range(0       ,					8_0     ):
                if 0 <= i < 2_0:
                    __magic_name__		:Optional[Any]        =      (b & c) | ((~b) & d)
                    __magic_name__		:str        =      0X5A82_7999
                elif 2_0 <= i < 4_0:
                    __magic_name__		:int        =      b ^ c ^ d
                    __magic_name__		:Union[str, Any]        =      0X6ED9_EBA1
                elif 4_0 <= i < 6_0:
                    __magic_name__		:List[Any]        =      (b & c) | (b & d) | (c & d)
                    __magic_name__		:Union[str, Any]        =      0X8F1B_BCDC
                elif 6_0 <= i < 8_0:
                    __magic_name__		:List[str]        =      b ^ c ^ d
                    __magic_name__		:Tuple        =      0XCA62_C1D6
                __magic_name__		:Tuple        =      (
                    self.rotate(_a       ,					5     ) + f + e + k + expanded_block[i] & 0XFFFF_FFFF,
                    a,
                    self.rotate(_a       ,					3_0     ),
                    c,
                    d,
                )
            __magic_name__		:Union[str, Any]        =      (
                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      __lowercase					( ):







    """simple docstring"""






    __magic_name__		:Union[str, Any]        =      b"""Test String"""
    assert SHAaHash(snake_case ).final_hash() == hashlib.shaa(snake_case ).hexdigest()  # noqa: S324

def      __lowercase					( ):







    """simple docstring"""






    __magic_name__		:Tuple        =      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__		: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:
            __magic_name__		:List[str]        =      f.read()
    else:
        __magic_name__		:List[Any]        =      bytes(snake_case,  '''utf-8''' )
    print(SHAaHash(snake_case ).final_hash() )


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

     doctest.testmod()














from __future__ import annotations

from typing import Any
class 						lowerCamelCase_				:







				def __init__(						self       ,					__lowerCAmelCase       ,					__lowerCAmelCase       ,					__lowerCAmelCase = 0     ):
								"""simple docstring"""
								__magic_name__     ,				__magic_name__		:Any        =      row, column
								__magic_name__		:Union[str, Any]        =      [[default_value for c in range(__lowerCAmelCase     )] for r in range(__lowerCAmelCase     )]







				def __str__(						self     ):
								"""simple docstring"""
								__magic_name__		:str        =      F'''Matrix consist of {self.row} rows and {self.column} columns\n'''

								# Make string identifier
								__magic_name__		:Dict        =      0
								for row_vector in self.array:
												for obj in row_vector:
																__magic_name__		:Dict        =      max(__lowerCAmelCase       ,					len(str(__lowerCAmelCase     )     )     )
								__magic_name__		:List[str]        =      F'''%{max_element_length}s'''

								# Make string and return
								def single_line(__lowerCAmelCase     ) -> str:
												nonlocal string_format_identifier
												__magic_name__		:int        =      '''['''
												line += ", ".join(string_format_identifier % (obj,) for obj in row_vector     )
												line += "]"
												return line

								s += "\n".join(single_line(__lowerCAmelCase     ) for row_vector in self.array     )
								return s







				def __repr__(						self     ):
								"""simple docstring"""
								return str(self     )







				def 			A	(						self       ,					__lowerCAmelCase     ):
								"""simple docstring"""
								if not (isinstance(__lowerCAmelCase       ,					(list, tuple)     ) and len(__lowerCAmelCase     ) == 2):
												return False
								elif not (0 <= loc[0] < self.row and 0 <= loc[1] < self.column):
												return False
								else:
												return True







				def __getitem__(						self       ,					__lowerCAmelCase     ):
								"""simple docstring"""
								assert self.validate_indicies(__lowerCAmelCase     )
								return self.array[loc[0]][loc[1]]







				def __setitem__(						self       ,					__lowerCAmelCase       ,					__lowerCAmelCase     ):
								"""simple docstring"""
								assert self.validate_indicies(__lowerCAmelCase     )
								__magic_name__		:List[Any]        =      value







				def __add__(						self       ,					__lowerCAmelCase     ):
								"""simple docstring"""
								assert isinstance(__lowerCAmelCase       ,					__lowerCAmelCase     )
								assert self.row == another.row and self.column == another.column

								# Add
								__magic_name__		:List[Any]        =      Matrix(self.row       ,					self.column     )
								for r in range(self.row     ):
												for c in range(self.column     ):
																__magic_name__		:Any        =      self[r, c] + another[r, c]
								return result







				def __neg__(						self     ):
								"""simple docstring"""
								__magic_name__		:Dict        =      Matrix(self.row       ,					self.column     )
								for r in range(self.row     ):
												for c in range(self.column     ):
																__magic_name__		:Any        =      -self[r, c]
								return result







				def __sub__(						self       ,					__lowerCAmelCase     ):
								"""simple docstring"""
								return self + (-another)







				def __mul__(						self       ,					__lowerCAmelCase     ):
								"""simple docstring"""

								if isinstance(__lowerCAmelCase       ,					(int, float)     ):  # Scalar multiplication
												__magic_name__		:List[str]        =      Matrix(self.row       ,					self.column     )
												for r in range(self.row     ):
																for c in range(self.column     ):
																				__magic_name__		:Tuple        =      self[r, c] * another
												return result
								elif isinstance(__lowerCAmelCase       ,					__lowerCAmelCase     ):  # Matrix multiplication
												assert self.column == another.row
												__magic_name__		:List[Any]        =      Matrix(self.row       ,					another.column     )
												for r in range(self.row     ):
																for c in range(another.column     ):
																				for i in range(self.column     ):
																								result[r, c] += self[r, i] * another[i, c]
												return result
								else:
												__magic_name__		:List[str]        =      F'''Unsupported type given for another ({type(__lowerCAmelCase     )})'''
												raise TypeError(__lowerCAmelCase     )







				def 			A	(						self     ):
								"""simple docstring"""
								__magic_name__		:int        =      Matrix(self.column       ,					self.row     )
								for r in range(self.row     ):
												for c in range(self.column     ):
																__magic_name__		:List[str]        =      self[r, c]
								return result







				def 			A	(						self       ,					__lowerCAmelCase       ,					__lowerCAmelCase     ):
								"""simple docstring"""
								assert isinstance(__lowerCAmelCase       ,					__lowerCAmelCase     ) and isinstance(__lowerCAmelCase       ,					__lowerCAmelCase     )
								assert self.row == self.column == u.row == v.row  # u, v should be column vector
								assert u.column == v.column == 1  # u, v should be column vector

								# Calculate
								__magic_name__		:int        =      v.transpose()
								__magic_name__		:str        =      (v_t * self * u)[0, 0] + 1
								if numerator_factor == 0:
												return None  # It's not invertable
								return self - ((self * u) * (v_t * self) * (1.0 / numerator_factor))


# Testing
if __name__ == "__main__":

					def      __lowercase					( ):







									"""simple docstring"""






									__magic_name__		:Optional[int]        =      Matrix(3,  3,  0 )
									for i in range(3 ):
													__magic_name__		:Tuple        =      1
									print(f'''a^(-1) is {ainv}''' )
									# u, v
									__magic_name__		:Optional[int]        =      Matrix(3,  1,  0 )
									__magic_name__     ,				__magic_name__     ,				__magic_name__		:Optional[int]        =      1, 2, -3
									__magic_name__		:int        =      Matrix(3,  1,  0 )
									__magic_name__     ,				__magic_name__     ,				__magic_name__		:str        =      4, -2, 5
									print(f'''u is {u}''' )
									print(f'''v is {v}''' )
									print(f'''uv^T is {u * v.transpose()}''' )
									# Sherman Morrison
									print(f'''(a + uv^T)^(-1) is {ainv.sherman_morrison(snake_case,  snake_case )}''' )

					def      __lowercase					( ):







									"""simple docstring"""






									import doctest

									doctest.testmod()

					testa()






