




'''simple docstring'''


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





class  __lowercase    :







   def __init__(						self   ,				UpperCamelCase   )					->     List[Any]:
     __a								=       data
     __a								=       [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__      (						UpperCamelCase   ,				UpperCamelCase   )					->     int:
     return ((n << b) | (n >> (32 - b))) & 0xF_F_F_F_F_F_F_F







   def 		UpperCamelCase__      (						self   )					->     int:
     __a								=       b'\x80' + b'\x00' * (63 - (len(self.data   ) + 8) % 64)
     __a								=       self.data + padding + struct.pack('>Q'   ,				8 * len(self.data   )   )
     return padded_data







   def 		UpperCamelCase__      (						self   )					->     Optional[Any]:
     return [
         self.padded_data[i : i + 64] for i in range(0   ,				len(self.padded_data   )   ,				64   )
     ]







   def 		UpperCamelCase__      (						self   ,				UpperCamelCase   )					->     Optional[Any]:
     __a								=       list(struct.unpack('>16L'   ,				UpperCamelCase   )   ) + [0] * 64
     for i in range(16   ,				80   ):
       __a								=       self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16])   ,				1   )
     return w







   def 		UpperCamelCase__      (						self   )					->     List[str]:
     __a								=       self.padding()
     __a								=       self.split_blocks()
     for block in self.blocks:
       __a								=       self.expand_block(UpperCamelCase   )
       __a						,							__a						,							__a						,							__a						,							__a								=       self.h
       for i in range(0   ,				80   ):
         if 0 <= i < 20:
           __a								=       (b & c) | ((~b) & d)
           __a								=       0x5_A_8_2_7_9_9_9
         elif 20 <= i < 40:
           __a								=       b ^ c ^ d
           __a								=       0x6_E_D_9_E_B_A_1
         elif 40 <= i < 60:
           __a								=       (b & c) | (b & d) | (c & d)
           __a								=       0x8_F_1_B_B_C_D_C
         elif 60 <= i < 80:
           __a								=       b ^ c ^ d
           __a								=       0xC_A_6_2_C_1_D_6
         __a						,							__a						,							__a						,							__a						,							__a								=       (
             self.rotate(UpperCamelCase   ,				5   ) + f + e + k + expanded_block[i] & 0xF_F_F_F_F_F_F_F,
             a,
             self.rotate(UpperCamelCase   ,				30   ),
             c,
             d,
         )
       __a								=       (
           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     SCREAMING_SNAKE_CASE							(   ):
  __a								=       B'Test String'
  assert SHAaHash(a_      ).final_hash() == hashlib.shaa(a_      ).hexdigest()  # noqa: S324


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


UpperCAmelCase_					=   {
    "configuration_clap": [
        "CLAP_PRETRAINED_MODEL_ARCHIVE_LIST",
        "ClapAudioConfig",
        "ClapConfig",
        "ClapTextConfig",
    ],
    "processing_clap": ["ClapProcessor"],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase_					=   [
      "CLAP_PRETRAINED_MODEL_ARCHIVE_LIST",
      "ClapModel",
      "ClapPreTrainedModel",
      "ClapTextModel",
      "ClapTextModelWithProjection",
      "ClapAudioModel",
      "ClapAudioModelWithProjection",
  ]
  UpperCAmelCase_					=   ["ClapFeatureExtractor"]

if TYPE_CHECKING:
  from .configuration_clap import (
      CLAP_PRETRAINED_MODEL_ARCHIVE_LIST,
      ClapAudioConfig,
      ClapConfig,
      ClapTextConfig,
  )
  from .processing_clap import ClapProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .feature_extraction_clap import ClapFeatureExtractor
    from .modeling_clap import (
        CLAP_PRETRAINED_MODEL_ARCHIVE_LIST,
        ClapAudioModel,
        ClapAudioModelWithProjection,
        ClapModel,
        ClapPreTrainedModel,
        ClapTextModel,
        ClapTextModelWithProjection,
    )


else:
  import sys

  UpperCAmelCase_					=   _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



