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


class       _lowerCAmelCase   :







							'''simple docstring'''

							def __init__(self  ,  UpperCAmelCase  )					->       Optional[int]:
														_snake_case       =  data
														_snake_case       =  [0x67_45_23_01, 0xEF_CD_AB_89, 0x98_BA_DC_FE, 0x10_32_54_76, 0xC3_D2_E1_F0]

							@staticmethod
							def 	lowercase							(UpperCAmelCase  ,  UpperCAmelCase  )					->       str:
														return ((n << b) | (n >> (32 - b))) & 0xFF_FF_FF_FF

							def 	lowercase							(self  )					->       Dict:
														_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 	lowercase							(self  )					->       Optional[int]:
														return [
														    self.padded_data[i : i + 64] for i in range(0  ,  len(self.padded_data  )  ,  64  )
														]

							def 	lowercase							(self  ,  UpperCAmelCase  )					->       Optional[int]:
														_snake_case       =  list(struct.unpack(""">16L"""  ,  UpperCAmelCase  )  ) + [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 	lowercase							(self  )					->       Any:
														_snake_case       =  self.padding()
														_snake_case       =  self.split_blocks()
														for block in self.blocks:
																					_snake_case       =  self.expand_block(UpperCAmelCase  )
																					_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       =  0x5A_82_79_99
																												elif 20 <= i < 40:
																																			_snake_case       =  b ^ c ^ d
																																			_snake_case       =  0x6E_D9_EB_A1
																												elif 40 <= i < 60:
																																			_snake_case       =  (b & c) | (b & d) | (c & d)
																																			_snake_case       =  0x8F_1B_BC_DC
																												elif 60 <= i < 80:
																																			_snake_case       =  b ^ c ^ d
																																			_snake_case       =  0xCA_62_C1_D6
																												_snake_case,							_snake_case,							_snake_case,							_snake_case,							_snake_case       =  (
																												    self.rotate(UpperCAmelCase  ,  5  ) + f + e + k + expanded_block[i] & 0xFF_FF_FF_FF,
																												    a,
																												    self.rotate(UpperCAmelCase  ,  30  ),
																												    c,
																												    d,
																												)
																					_snake_case       =  (
																					    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  __SCREAMING_SNAKE_CASE				(  ):
							_snake_case       =  b"""Test String"""
							assert SHAaHash(_SCREAMING_SNAKE_CASE				).final_hash() == hashlib.shaa(_SCREAMING_SNAKE_CASE				).hexdigest()  # noqa: S324






def  __SCREAMING_SNAKE_CASE				(  ):
							_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(_SCREAMING_SNAKE_CASE							, """utf-8"""				)
							print(SHAaHash(_SCREAMING_SNAKE_CASE				).final_hash()				)


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

				doctest.testmod()

'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


__lowerCAmelCase												=	{
    'configuration_efficientformer': [
        'EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'EfficientFormerConfig',
    ]
}

try:
				if not is_vision_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__lowerCAmelCase												=	['EfficientFormerImageProcessor']

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__lowerCAmelCase												=	[
				    'EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'EfficientFormerForImageClassification',
				    'EfficientFormerForImageClassificationWithTeacher',
				    'EfficientFormerModel',
				    'EfficientFormerPreTrainedModel',
				]

try:
				if not is_tf_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__lowerCAmelCase												=	[
				    'TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'TFEfficientFormerForImageClassification',
				    'TFEfficientFormerForImageClassificationWithTeacher',
				    'TFEfficientFormerModel',
				    'TFEfficientFormerPreTrainedModel',
				]

if TYPE_CHECKING:
				from .configuration_efficientformer import EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, EfficientFormerConfig

				try:
								if not is_vision_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .image_processing_efficientformer import EfficientFormerImageProcessor

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_efficientformer import (
								    EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    EfficientFormerForImageClassification,
								    EfficientFormerForImageClassificationWithTeacher,
								    EfficientFormerModel,
								    EfficientFormerPreTrainedModel,
								)
				try:
								if not is_tf_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_tf_efficientformer import (
								    TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    TFEfficientFormerForImageClassification,
								    TFEfficientFormerForImageClassificationWithTeacher,
								    TFEfficientFormerModel,
								    TFEfficientFormerPreTrainedModel,
								)

else:
				import sys

				__lowerCAmelCase												=	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)