



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


class 							lowerCamelCase_:





     '''simple docstring'''



     def __init__(    self				,       lowerCamelCase__   ):
         _lowerCamelCase        =				data
         _lowerCamelCase        =				[0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]

     @staticmethod
     def 			snake_case__      (    lowerCamelCase__				,       lowerCamelCase__   ):
         return ((n << b) | (n >> (3_2 - b))) & 0xFFFFFFFF

     def 			snake_case__      (    self   ):
         _lowerCamelCase        =				b'''\x80''' + b'''\x00''' * (6_3 - (len(self.data   ) + 8) % 6_4)
         _lowerCamelCase        =				self.data + padding + struct.pack('''>Q'''				,       8 * len(self.data   )   )
         return padded_data

     def 			snake_case__      (    self   ):
         return [
             self.padded_data[i : i + 6_4] for i in range(0				,       len(self.padded_data   )				,       6_4   )
         ]

     def 			snake_case__      (    self				,       lowerCamelCase__   ):
         _lowerCamelCase        =				list(struct.unpack('''>16L'''				,       UpperCAmelCase_   )   ) + [0] * 6_4
         for i in range(1_6				,       8_0   ):
             _lowerCamelCase        =				self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 1_4] ^ w[i - 1_6])				,       1   )
         return w





     def 			snake_case__      (    self   ):
         _lowerCamelCase        =				self.padding()
         _lowerCamelCase        =				self.split_blocks()
         for block in self.blocks:
             _lowerCamelCase        =				self.expand_block(UpperCAmelCase_   )
             _lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase        =				self.h
             for i in range(0				,       8_0   ):
                 if 0 <= i < 2_0:
                     _lowerCamelCase        =				(b & c) | ((~b) & d)
                     _lowerCamelCase        =				0x5A827999
                 elif 2_0 <= i < 4_0:
                     _lowerCamelCase        =				b ^ c ^ d
                     _lowerCamelCase        =				0x6ED9EBA1
                 elif 4_0 <= i < 6_0:
                     _lowerCamelCase        =				(b & c) | (b & d) | (c & d)
                     _lowerCamelCase        =				0x8F1BBCDC
                 elif 6_0 <= i < 8_0:
                     _lowerCamelCase        =				b ^ c ^ d
                     _lowerCamelCase        =				0xCA62C1D6
                 _lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase  ,     _lowerCamelCase        =				(
                     self.rotate(UpperCAmelCase_				,       5   ) + f + e + k + expanded_block[i] & 0xFFFFFFFF,
                     a,
                     self.rotate(UpperCAmelCase_				,       3_0   ),
                     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_(   )	->       Tuple:
    _lowerCamelCase        =				B'''Test String'''
    assert SHAaHash(_snake_case							).final_hash() == hashlib.shaa(_snake_case							).hexdigest()  # noqa: S324



def        lowerCAmelCase_(   )	->       Dict:
    _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(_snake_case						,   '''utf-8'''							)
    print(SHAaHash(_snake_case							).final_hash()							)


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

   doctest.testmod()





"""simple docstring"""
import numpy as np



def        lowerCAmelCase_(   lowercase_     :							np.array							)	->       np.array:
				return 1 / (1 + np.exp(-vector							))



def        lowerCAmelCase_(   lowercase_     :							np.array							)	->       np.array:
				return vector * sigmoid(1.7_0_2 * vector							)


if __name__ == "__main__":
			import doctest

			doctest.testmod()
