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


class       UpperCAmelCase__     :



  """simple docstring"""






  def __init__(					self:      Optional[Any]					,					__lowerCAmelCase:      Union[str, Any] )			->			Optional[int]:




    '''simple docstring'''




    __UpperCAmelCase         =							data
    __UpperCAmelCase         =							[0X67_45_23_01, 0Xef_cd_ab_89, 0X98_ba_dc_fe, 0X10_32_54_76, 0Xc3_d2_e1_f0]






  @staticmethod
  def 						_UpperCAmelCase					(					__lowerCAmelCase:      List[Any]					,					__lowerCAmelCase:      List[str] )			->			List[Any]:




    '''simple docstring'''




    return ((n << b) | (n >> (32 - b))) & 0Xff_ff_ff_ff






  def 						_UpperCAmelCase					(					self:      Optional[int] )			->			List[str]:




    '''simple docstring'''




    __UpperCAmelCase         =							B"\x80" + B"\x00" * (63 - (len(self.data ) + 8) % 64)
    __UpperCAmelCase         =							self.data + padding + struct.pack(">Q"					,					8 * len(self.data ) )
    return padded_data






  def 						_UpperCAmelCase					(					self:      List[str] )			->			Dict:




    '''simple docstring'''




    return [
        self.padded_data[i : i + 64] for i in range(0					,					len(self.padded_data )					,					64 )
    ]






  def 						_UpperCAmelCase					(					self:      Union[str, Any]					,					__lowerCAmelCase:      Dict )			->			Optional[Any]:




    '''simple docstring'''




    __UpperCAmelCase         =							list(struct.unpack(">16L"					,					__lowerCAmelCase ) ) + [0] * 64
    for i in range(16					,					80 ):
      __UpperCAmelCase         =							self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16])					,					1 )
    return w






  def 						_UpperCAmelCase					(					self:      Any )			->			List[str]:




    '''simple docstring'''




    __UpperCAmelCase         =							self.padding()
    __UpperCAmelCase         =							self.split_blocks()
    for block in self.blocks:
      __UpperCAmelCase         =							self.expand_block(__lowerCAmelCase )
      __UpperCAmelCase     ,		__UpperCAmelCase     ,		__UpperCAmelCase     ,		__UpperCAmelCase     ,		__UpperCAmelCase         =							self.h
      for i in range(0					,					80 ):
        if 0 <= i < 20:
          __UpperCAmelCase         =							(b & c) | ((~b) & d)
          __UpperCAmelCase         =							0X5a_82_79_99
        elif 20 <= i < 40:
          __UpperCAmelCase         =							b ^ c ^ d
          __UpperCAmelCase         =							0X6e_d9_eb_a1
        elif 40 <= i < 60:
          __UpperCAmelCase         =							(b & c) | (b & d) | (c & d)
          __UpperCAmelCase         =							0X8f_1b_bc_dc
        elif 60 <= i < 80:
          __UpperCAmelCase         =							b ^ c ^ d
          __UpperCAmelCase         =							0Xca_62_c1_d6
        __UpperCAmelCase     ,		__UpperCAmelCase     ,		__UpperCAmelCase     ,		__UpperCAmelCase     ,		__UpperCAmelCase         =							(
            self.rotate(__lowerCAmelCase					,					5 ) + f + e + k + expanded_block[i] & 0Xff_ff_ff_ff,
            a,
            self.rotate(__lowerCAmelCase					,					30 ),
            c,
            d,
        )
      __UpperCAmelCase         =							(
          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    __lowerCAmelCase   (    )     ->	Dict:
  __UpperCAmelCase         =							B"Test String"
  assert SHAaHash(a__       ).final_hash() == hashlib.shaa(a__       ).hexdigest()  # noqa: S324




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


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

       doctest.testmod()










# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.:
#   python ./utils/get_modified_files.py utils src tests examples
#
# it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered
# since the output of this script is fed into Makefile commands it doesn't print a newline after the results

import re
import subprocess
import sys


UpperCamelCase__           =			subprocess.check_output("git merge-base main HEAD".split()).decode("utf-8")
UpperCamelCase__           =			subprocess.check_output(f"""git diff --name-only {fork_point_sha}""".split()).decode("utf-8").split()

UpperCamelCase__           =			"|".join(sys.argv[1:])
UpperCamelCase__           =			re.compile(rf"""^({joined_dirs}).*?\.py$""")

UpperCamelCase__           =			[x for x in modified_files if regex.match(x)]
print(" ".join(relevant_modified_files), end="")




