'''simple docstring'''




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




class     a__      :






     def __init__( self		:		str  ,				a		:		Dict    ):





         """simple docstring"""



         __lowerCamelCase		=  data
         __lowerCamelCase		=  [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]






     @staticmethod
     def    SCREAMING_SNAKE_CASE__   ( a		:		Union[str, Any]  ,				a		:		Any    ):





         """simple docstring"""



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






     def    SCREAMING_SNAKE_CASE__   ( self		:		Any    ):





         """simple docstring"""



         __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    SCREAMING_SNAKE_CASE__   ( self		:		List[Any]    ):





         """simple docstring"""



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






     def    SCREAMING_SNAKE_CASE__   ( self		:		List[Any]  ,				a		:		Tuple    ):





         """simple docstring"""



         __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    SCREAMING_SNAKE_CASE__   ( self		:		Any    ):





         """simple docstring"""



         __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		=  0x5A827999
                 elif 20 <= i < 40:
                     __lowerCamelCase		=  b ^ c ^ d
                     __lowerCamelCase		=  0x6ED9EBA1
                 elif 40 <= i < 60:
                     __lowerCamelCase		=  (b & c) | (b & d) | (c & d)
                     __lowerCamelCase		=  0x8F1BBCDC
                 elif 60 <= i < 80:
                     __lowerCamelCase		=  b ^ c ^ d
                     __lowerCamelCase		=  0xCA62C1D6
                 __lowerCamelCase	,  __lowerCamelCase	,  __lowerCamelCase	,  __lowerCamelCase	,  __lowerCamelCase		=  (
                     self.rotate(a  ,				5    ) + f + e + k + expanded_block[i] & 0xFFFFFFFF,
                     a,
                     self.rotate(a  ,				30    ),
                     c,
                     d,
                 )
             __lowerCamelCase		=  (
                 self.h[0] + a & 0xFFFFFFFF,
                 self.h[1] + b & 0xFFFFFFFF,
                 self.h[2] + c & 0xFFFFFFFF,
                 self.h[3] + d & 0xFFFFFFFF,
                 self.h[4] + e & 0xFFFFFFFF,
             )
         return ("{:08x}" * 5).format(*self.h    )






def __lowerCAmelCase (							)	->    List[str]:
    __lowerCamelCase		=  B'''Test String'''
    assert SHAaHash(UpperCamelCase__				).final_hash() == hashlib.shaa(UpperCamelCase__				).hexdigest()  # noqa: S324






def __lowerCAmelCase (							)	->    List[str]:
    __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(UpperCamelCase__				,  '''utf-8'''				)
    print(SHAaHash(UpperCamelCase__				).final_hash()				)


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

  doctest.testmod()


'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


_lowercase :  Union[str, Any]    							=       {
    "configuration_mask2former": [
        "MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "Mask2FormerConfig",
    ],
}

try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowercase :  Optional[int]    							=       ["Mask2FormerImageProcessor"]

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowercase :  str    							=       [
							    "MASK2FORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "Mask2FormerForUniversalSegmentation",
							    "Mask2FormerModel",
							    "Mask2FormerPreTrainedModel",
							]

if TYPE_CHECKING:
							from .configuration_maskaformer import MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, MaskaFormerConfig

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .image_processing_maskaformer import MaskaFormerImageProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_maskaformer import (
														    MASK2FORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
														    MaskaFormerForUniversalSegmentation,
														    MaskaFormerModel,
														    MaskaFormerPreTrainedModel,
														)


else:
							import sys

							_lowercase :  Dict    							=       _LazyModule(__name__, globals()["__file__"], _import_structure)



