






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






 '''simple docstring'''




 def __init__(	self							,  _A) ->		Optional[int]:

     """simple docstring"""



     _UpperCAmelCase				:      str			  =				data
     _UpperCAmelCase				:      Optional[int]			  =				[0X67_45_23_01, 0Xef_cd_ab_89, 0X98_ba_dc_fe, 0X10_32_54_76, 0Xc3_d2_e1_f0]


 @staticmethod
 def  snake_case__				(	_A							,  _A) ->		Any:

     """simple docstring"""



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


 def  snake_case__				(	self) ->		Any:

     """simple docstring"""



     _UpperCAmelCase				:      Any			  =				B'''\x80''' + B'''\x00''' * (63 - (len(self.data) + 8) % 64)
     _UpperCAmelCase				:      Optional[Any]			  =				self.data + padding + struct.pack('''>Q'''							,  8 * len(self.data))
     return padded_data


 def  snake_case__				(	self) ->		int:

     """simple docstring"""



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


 def  snake_case__				(	self							,  _A) ->		str:

     """simple docstring"""



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


 def  snake_case__				(	self) ->		Dict:

     """simple docstring"""



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

def      _lowerCamelCase	(						)      ->					int:
    _UpperCAmelCase				:      List[str]			  =				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				:      Optional[Any]			  =				parser.parse_args()
    _UpperCAmelCase				:      Union[str, Any]			  =				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				:      Dict			  =				f.read()
    else:
        _UpperCAmelCase				:      Union[str, Any]			  =				bytes(__A		,		'''utf-8''' )
    print(SHAaHash(__A ).final_hash() )


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

  doctest.testmod()












import numpy as np
import skfuzzy as fuzz

if __name__ == "__main__":
  # Create universe of discourse in Python using linspace ()
  SCREAMING_SNAKE_CASE 							=						np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False)

  # Create two fuzzy sets by defining any membership function
  # (trapmf(), gbellmf(), gaussmf(), etc).
  SCREAMING_SNAKE_CASE 							=						[0, 25, 50]
  SCREAMING_SNAKE_CASE 							=						[25, 50, 75]
  SCREAMING_SNAKE_CASE 							=						fuzz.membership.trimf(X, abca)
  SCREAMING_SNAKE_CASE 							=						fuzz.membership.trimf(X, abca)

  # Compute the different operations using inbuilt functions.
  SCREAMING_SNAKE_CASE 							=						np.ones(75)
  SCREAMING_SNAKE_CASE 							=						np.zeros((75,))
  # 1. Union = max(µA(x), µB(x))
  SCREAMING_SNAKE_CASE 							=						fuzz.fuzzy_or(X, young, X, middle_aged)[1]
  # 2. Intersection = min(µA(x), µB(x))
  SCREAMING_SNAKE_CASE 							=						fuzz.fuzzy_and(X, young, X, middle_aged)[1]
  # 3. Complement (A) = (1- min(µA(x))
  SCREAMING_SNAKE_CASE 							=						fuzz.fuzzy_not(young)
  # 4. Difference (A/B) = min(µA(x),(1- µB(x)))
  SCREAMING_SNAKE_CASE 							=						fuzz.fuzzy_and(X, young, X, fuzz.fuzzy_not(middle_aged)[1])[1]
  # 5. Algebraic Sum = [µA(x) + µB(x) – (µA(x) * µB(x))]
  SCREAMING_SNAKE_CASE 							=						young + middle_aged - (young * middle_aged)
  # 6. Algebraic Product = (µA(x) * µB(x))
  SCREAMING_SNAKE_CASE 							=						young * middle_aged
  # 7. Bounded Sum = min[1,(µA(x), µB(x))]
  SCREAMING_SNAKE_CASE 							=						fuzz.fuzzy_and(X, one, X, young + middle_aged)[1]
  # 8. Bounded difference = min[0,(µA(x), µB(x))]
  SCREAMING_SNAKE_CASE 							=						fuzz.fuzzy_or(X, zero, X, young - middle_aged)[1]

  # max-min composition
  # max-product composition

  # Plot each set A, set B and each operation result using plot() and subplot().
  from matplotlib import pyplot as plt

  plt.figure()

  plt.subplot(4, 3, 1)
  plt.plot(X, young)
  plt.title('Young')
  plt.grid(True)

  plt.subplot(4, 3, 2)
  plt.plot(X, middle_aged)
  plt.title('Middle aged')
  plt.grid(True)

  plt.subplot(4, 3, 3)
  plt.plot(X, union)
  plt.title('union')
  plt.grid(True)

  plt.subplot(4, 3, 4)
  plt.plot(X, intersection)
  plt.title('intersection')
  plt.grid(True)

  plt.subplot(4, 3, 5)
  plt.plot(X, complement_a)
  plt.title('complement_a')
  plt.grid(True)

  plt.subplot(4, 3, 6)
  plt.plot(X, difference)
  plt.title('difference a/b')
  plt.grid(True)

  plt.subplot(4, 3, 7)
  plt.plot(X, alg_sum)
  plt.title('alg_sum')
  plt.grid(True)

  plt.subplot(4, 3, 8)
  plt.plot(X, alg_product)
  plt.title('alg_product')
  plt.grid(True)

  plt.subplot(4, 3, 9)
  plt.plot(X, bdd_sum)
  plt.title('bdd_sum')
  plt.grid(True)

  plt.subplot(4, 3, 10)
  plt.plot(X, bdd_difference)
  plt.title('bdd_difference')
  plt.grid(True)

  plt.subplots_adjust(hspace=0.5)
  plt.show()




