





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







class      lowerCamelCase:
     '''simple docstring'''


     def __init__(    self				,     snake_case_							):
         _A     =							data
         _A     =							[0X6745_2301, 0XEFCD_AB89, 0X98BA_DCFE, 0X1032_5476, 0XC3D2_E1F0]




     @staticmethod
     def        lowerCAmelCase__		(    snake_case_				,     snake_case_							):
         return ((n << b) | (n >> (32 - b))) & 0XFFFF_FFFF




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




     def        lowerCAmelCase__		(    self				,     snake_case_							):
         _A     =							list(struct.unpack('>16L'				,     snake_case_							)							) + [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        lowerCAmelCase__		(    self							):
         _A     =							self.padding()
         _A     =							self.split_blocks()
         for block in self.blocks:
             _A     =							self.expand_block(snake_case_							)
             _A,			_A,			_A,			_A,			_A     =							self.h
             for i in range(0				,     80							):
                 if 0 <= i < 20:
                     _A     =							(b & c) | ((~b) & d)
                     _A     =							0X5A82_7999
                 elif 20 <= i < 40:
                     _A     =							b ^ c ^ d
                     _A     =							0X6ED9_EBA1
                 elif 40 <= i < 60:
                     _A     =							(b & c) | (b & d) | (c & d)
                     _A     =							0X8F1B_BCDC
                 elif 60 <= i < 80:
                     _A     =							b ^ c ^ d
                     _A     =							0XCA62_C1D6
                 _A,			_A,			_A,			_A,			_A     =							(
                     self.rotate(snake_case_				,     5							) + f + e + k + expanded_block[i] & 0XFFFF_FFFF,
                     a,
                     self.rotate(snake_case_				,     30							),
                     c,
                     d,
                 )
             _A     =							(
                 self.h[0] + a & 0XFFFF_FFFF,
                 self.h[1] + b & 0XFFFF_FFFF,
                 self.h[2] + c & 0XFFFF_FFFF,
                 self.h[3] + d & 0XFFFF_FFFF,
                 self.h[4] + e & 0XFFFF_FFFF,
             )
         return ("{:08x}" * 5).format(*self.h							)





def 				__lowerCAmelCase(       )							-> Any:




    """simple docstring"""




    _A     =							b'Test String'
    assert SHAaHash(_SCREAMING_SNAKE_CASE				).final_hash() == hashlib.shaa(_SCREAMING_SNAKE_CASE				).hexdigest()  # noqa: S324





def 				__lowerCAmelCase(       )							-> int:




    """simple docstring"""




    _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(_SCREAMING_SNAKE_CASE							,     'utf-8'				)
    print(SHAaHash(_SCREAMING_SNAKE_CASE				).final_hash()				)


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

 doctest.testmod()












from collections.abc import Callable





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE				)							-> float:




    """simple docstring"""




    _A     =							a
    _A     =							b
    if function(_SCREAMING_SNAKE_CASE				) == 0:  # one of the a or b is a root for the function
        return a
    elif function(_SCREAMING_SNAKE_CASE				) == 0:
        return b
    elif (
        function(_SCREAMING_SNAKE_CASE				) * function(_SCREAMING_SNAKE_CASE				) > 0
    ):  # if none of these are root and they are both positive or negative,
        # then this algorithm can't find the root
        raise ValueError('could not find root in given interval.'				)
    else:
        _A     =							start + (end - start) / 2.0
        while abs(start - mid				) > 10**-7:  # until precisely equals to 10^-7
            if function(_SCREAMING_SNAKE_CASE				) == 0:
                return mid
            elif function(_SCREAMING_SNAKE_CASE				) * function(_SCREAMING_SNAKE_CASE				) < 0:
                _A     =							mid
            else:
                _A     =							mid
            _A     =							start + (end - start) / 2.0
        return mid





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE				)							-> float:




    """simple docstring"""




    return x**3 - 2 * x - 5


if __name__ == "__main__":
 print(bisection(f, 1, 1_000))

 import doctest

 doctest.testmod()





