





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







class    __snake_case	:





							'''simple docstring'''







							def __init__(  self			:   int							,    A			:   str		):
									__snake_case:						Optional[int]			  =						data
									__snake_case:						List[str]			  =						[0x67_45_23_01, 0xef_cd_ab_89, 0x98_ba_dc_fe, 0x10_32_54_76, 0xc3_d2_e1_f0]




							@staticmethod
							def 							UpperCAmelCase__			(  A			:   str							,    A			:   Any		):
									return ((n << b) | (n >> (32 - b))) & 0xff_ff_ff_ff




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




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




							def 							UpperCAmelCase__			(  self			:   List[str]							,    A			:   Dict		):
									__snake_case:						Union[str, Any]			  =						list(struct.unpack(""">16L"""							,    A		)		) + [0] * 64
									for i in range(16							,    80		):
											__snake_case:						int			  =						self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16])							,    1		)
									return w






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







def       A__							(   )       ->   Optional[int]:
		__snake_case:						str			  =						b"""Test String"""
		assert SHAaHash(SCREAMING_SNAKE_CASE__).final_hash() == hashlib.shaa(SCREAMING_SNAKE_CASE__).hexdigest()  # noqa: S324







def       A__							(   )       ->   Union[str, Any]:
		__snake_case:						List[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""")
		__snake_case:						Dict			  =						parser.parse_args()
		__snake_case:						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:
						__snake_case:						int			  =						f.read()
		else:
				__snake_case:						Any			  =						bytes(SCREAMING_SNAKE_CASE__ , """utf-8""")
		print(SHAaHash(SCREAMING_SNAKE_CASE__).final_hash())


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

						doctest.testmod()













from __future__ import annotations

from decimal import Decimal

from numpy import array







def       A__							(   SCREAMING_SNAKE_CASE__)       ->   list[list[float]]:
  __snake_case:						Any			  =						Decimal

  # Check if the provided matrix has 2 rows and 2 columns
  # since this implementation only works for 2x2 matrices
  if len(SCREAMING_SNAKE_CASE__) == 2 and len(matrix[0]) == 2 and len(matrix[1]) == 2:
    # Calculate the determinant of the matrix
    __snake_case:						Tuple			  =						float(
        d(matrix[0][0]) * d(matrix[1][1]) - d(matrix[1][0]) * d(matrix[0][1]))
    if determinant == 0:
      raise ValueError("""This matrix has no inverse.""")

    # Creates a copy of the matrix with swapped positions of the elements
    __snake_case:						Optional[int]			  =						[[0.0, 0.0], [0.0, 0.0]]
    __snake_case  ,       __snake_case:						Optional[Any]			  =						matrix[1][1], matrix[0][0]
    __snake_case  ,       __snake_case:						Union[str, Any]			  =						-matrix[1][0], -matrix[0][1]

    # Calculate the inverse of the matrix
    return [
        [(float(d(SCREAMING_SNAKE_CASE__)) / determinant) or 0.0 for n in row] for row in swapped_matrix
    ]
  elif (
      len(SCREAMING_SNAKE_CASE__) == 3
      and len(matrix[0]) == 3
      and len(matrix[1]) == 3
      and len(matrix[2]) == 3
  ):
    # Calculate the determinant of the matrix using Sarrus rule
    __snake_case:						Any			  =						float(
        (
            (d(matrix[0][0]) * d(matrix[1][1]) * d(matrix[2][2]))
            + (d(matrix[0][1]) * d(matrix[1][2]) * d(matrix[2][0]))
            + (d(matrix[0][2]) * d(matrix[1][0]) * d(matrix[2][1]))
        )
        - (
            (d(matrix[0][2]) * d(matrix[1][1]) * d(matrix[2][0]))
            + (d(matrix[0][1]) * d(matrix[1][0]) * d(matrix[2][2]))
            + (d(matrix[0][0]) * d(matrix[1][2]) * d(matrix[2][1]))
        ))
    if determinant == 0:
      raise ValueError("""This matrix has no inverse.""")

    # Creating cofactor matrix
    __snake_case:						Tuple			  =						[
        [d(0.0), d(0.0), d(0.0)],
        [d(0.0), d(0.0), d(0.0)],
        [d(0.0), d(0.0), d(0.0)],
    ]
    __snake_case:						Dict			  =						(d(matrix[1][1]) * d(matrix[2][2])) - (
        d(matrix[1][2]) * d(matrix[2][1])
    )
    __snake_case:						Tuple			  =						-(
        (d(matrix[1][0]) * d(matrix[2][2])) - (d(matrix[1][2]) * d(matrix[2][0]))
    )
    __snake_case:						Optional[int]			  =						(d(matrix[1][0]) * d(matrix[2][1])) - (
        d(matrix[1][1]) * d(matrix[2][0])
    )
    __snake_case:						Union[str, Any]			  =						-(
        (d(matrix[0][1]) * d(matrix[2][2])) - (d(matrix[0][2]) * d(matrix[2][1]))
    )
    __snake_case:						str			  =						(d(matrix[0][0]) * d(matrix[2][2])) - (
        d(matrix[0][2]) * d(matrix[2][0])
    )
    __snake_case:						List[Any]			  =						-(
        (d(matrix[0][0]) * d(matrix[2][1])) - (d(matrix[0][1]) * d(matrix[2][0]))
    )
    __snake_case:						Optional[Any]			  =						(d(matrix[0][1]) * d(matrix[1][2])) - (
        d(matrix[0][2]) * d(matrix[1][1])
    )
    __snake_case:						List[str]			  =						-(
        (d(matrix[0][0]) * d(matrix[1][2])) - (d(matrix[0][2]) * d(matrix[1][0]))
    )
    __snake_case:						Optional[int]			  =						(d(matrix[0][0]) * d(matrix[1][1])) - (
        d(matrix[0][1]) * d(matrix[1][0])
    )

    # Transpose the cofactor matrix (Adjoint matrix)
    __snake_case:						List[Any]			  =						array(SCREAMING_SNAKE_CASE__)
    for i in range(3):
      for j in range(3):
        __snake_case:						Tuple			  =						cofactor_matrix[j][i]

        # Inverse of the matrix using the formula (1/determinant) * adjoint matrix
    __snake_case:						List[Any]			  =						array(SCREAMING_SNAKE_CASE__)
    for i in range(3):
      for j in range(3):
        inverse_matrix[i][j] /= d(SCREAMING_SNAKE_CASE__)

        # Calculate the inverse of the matrix
    return [[float(d(SCREAMING_SNAKE_CASE__)) or 0.0 for n in row] for row in inverse_matrix]
  raise ValueError("""Please provide a matrix of size 2x2 or 3x3.""")






