

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



class   lowercase_   :



      def __init__(      self				:    Optional[int]      , A__				:    List[str]		)   ->					Tuple:
        _snake_case						=							data
        _snake_case						=							[0X6_7_4_5_2_3_0_1, 0XE_F_C_D_A_B_8_9, 0X9_8_B_A_D_C_F_E, 0X1_0_3_2_5_4_7_6, 0XC_3_D_2_E_1_F_0]



      @staticmethod
      def 						UpperCamelCase_		(      A__				:    List[str]      , A__				:    Union[str, Any]		)   ->					Optional[Any]:
        return ((n << b) | (n >> (32 - b))) & 0XF_F_F_F_F_F_F_F



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



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



      def 						UpperCamelCase_		(      self				:    Tuple      , A__				:    List[str]		)   ->					Dict:
        _snake_case						=							list(struct.unpack('''>16L'''      , A__		)		) + [0] * 64
        for i in range(16      , 80		):
          _snake_case						=							self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16])      , 1		)
        return w







      def 						UpperCamelCase_		(      self				:    List[str]		)   ->					Union[str, Any]:
        _snake_case						=							self.padding()
        _snake_case						=							self.split_blocks()
        for block in self.blocks:
          _snake_case						=							self.expand_block(A__		)
          _snake_case,					_snake_case,					_snake_case,					_snake_case,					_snake_case						=							self.h
          for i in range(0      , 80		):
            if 0 <= i < 20:
              _snake_case						=							(b & c) | ((~b) & d)
              _snake_case						=							0X5_A_8_2_7_9_9_9
            elif 20 <= i < 40:
              _snake_case						=							b ^ c ^ d
              _snake_case						=							0X6_E_D_9_E_B_A_1
            elif 40 <= i < 60:
              _snake_case						=							(b & c) | (b & d) | (c & d)
              _snake_case						=							0X8_F_1_B_B_C_D_C
            elif 60 <= i < 80:
              _snake_case						=							b ^ c ^ d
              _snake_case						=							0XC_A_6_2_C_1_D_6
            _snake_case,					_snake_case,					_snake_case,					_snake_case,					_snake_case						=							(
                self.rotate(A__      , 5		) + f + e + k + expanded_block[i] & 0XF_F_F_F_F_F_F_F,
                a,
                self.rotate(A__      , 30		),
                c,
                d,
            )
          _snake_case						=							(
              self.h[0] + a & 0XF_F_F_F_F_F_F_F,
              self.h[1] + b & 0XF_F_F_F_F_F_F_F,
              self.h[2] + c & 0XF_F_F_F_F_F_F_F,
              self.h[3] + d & 0XF_F_F_F_F_F_F_F,
              self.h[4] + e & 0XF_F_F_F_F_F_F_F,
          )
        return ("{:08x}" * 5).format(*self.h		)



def 				snake_case_()							->     List[str]:



  """simple docstring"""






  _snake_case						=							b'''Test String'''
  assert SHAaHash(_UpperCamelCase					).final_hash() == hashlib.shaa(_UpperCamelCase					).hexdigest()  # noqa: S324



def 				snake_case_()							->     str:



  """simple docstring"""






  _snake_case						=							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						=							parser.parse_args()
  _snake_case						=							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						=							f.read()
  else:
    _snake_case						=							bytes(_UpperCamelCase			,	'''utf-8'''					)
  print(SHAaHash(_UpperCamelCase					).final_hash()					)


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

 doctest.testmod()




def 				snake_case_(_UpperCamelCase			,	_UpperCamelCase					)							->     str:



  """simple docstring"""






  if a < 0 or b < 0:
    raise ValueError('''the value of both inputs must be positive'''					)
  _snake_case						=							str(bin(_UpperCamelCase					)					)[2:]  # remove the leading "0b"
  _snake_case						=							str(bin(_UpperCamelCase					)					)[2:]
  _snake_case						=							max(len(_UpperCamelCase					)			,	len(_UpperCamelCase					)					)
  return "0b" + "".join(
      str(int('''1''' in (char_a, char_b)					)					)
      for char_a, char_b in zip(a_binary.zfill(_UpperCamelCase					)			,	b_binary.zfill(_UpperCamelCase					)					)					)


if __name__ == "__main__":
 import doctest

 doctest.testmod()

