


'''simple docstring'''






from collections.abc import Generator
from math import sin





def lowerCamelCase__     (		__lowerCamelCase			:				bytes				):







   '''simple docstring'''




   if len(__lowerCamelCase				) != 3_2:
      raise ValueError('Input must be of length 32'				)

   _UpperCAmelCase  :  Union[str, Any]				       =b''
   for i in [3, 2, 1, 0]:
      little_endian += string_aa[8 * i : 8 * i + 8]
   return little_endian





def lowerCamelCase__     (		__lowerCamelCase			:				int				):







   '''simple docstring'''




   if i < 0:
      raise ValueError('Input must be non-negative'				)

   _UpperCAmelCase  :  Tuple				       =format(__lowerCamelCase			,       '08x'				)[-8:]
   _UpperCAmelCase  :  List[Any]				       =b''
   for i in [3, 2, 1, 0]:
      little_endian_hex += hex_rep[2 * i : 2 * i + 2].encode('utf-8'				)
   return little_endian_hex





def lowerCamelCase__     (		__lowerCamelCase			:				bytes				):







   '''simple docstring'''




   _UpperCAmelCase  :  Dict				       =b''
   for char in message:
      bit_string += format(__lowerCamelCase			,       '08b'				).encode('utf-8'				)
   _UpperCAmelCase  :  str				       =format(len(__lowerCamelCase				)			,       '064b'				).encode('utf-8'				)

   # Pad bit_string to a multiple of 512 chars
   bit_string += b"1"
   while len(__lowerCamelCase				) % 5_1_2 != 4_4_8:
      bit_string += b"0"
   bit_string += to_little_endian(start_len[3_2:]				) + to_little_endian(start_len[:3_2]				)

   return bit_string





def lowerCamelCase__     (		__lowerCamelCase			:				bytes				):







   '''simple docstring'''




   if len(__lowerCamelCase				) % 5_1_2 != 0:
      raise ValueError('Input must have length that\'s a multiple of 512'				)

   for pos in range(0			,       len(__lowerCamelCase				)			,       5_1_2				):
      _UpperCAmelCase  :  List[str]				       =bit_string[pos : pos + 5_1_2]
      _UpperCAmelCase  :  Union[str, Any]				       =[]
      for i in range(0			,       5_1_2			,       3_2				):
         block_words.append(int(to_little_endian(block[i : i + 3_2]				)			,       2				)				)
      yield block_words





def lowerCamelCase__     (		__lowerCamelCase			:				int				):







   '''simple docstring'''




   if i < 0:
      raise ValueError('Input must be non-negative'				)

   _UpperCAmelCase  :  List[Any]				       =format(__lowerCamelCase			,       '032b'				)
   _UpperCAmelCase  :  Tuple				       =''
   for c in i_str:
      new_str += "1" if c == "0" else "0"
   return int(__lowerCamelCase			,       2				)





def lowerCamelCase__     (		__lowerCamelCase			:				int			,       __lowerCamelCase			:				int				):







   '''simple docstring'''




   return (a + b) % 2**3_2





def lowerCamelCase__     (		__lowerCamelCase			:				int			,       __lowerCamelCase			:				int				):







   '''simple docstring'''




   if i < 0:
      raise ValueError('Input must be non-negative'				)
   if shift < 0:
      raise ValueError('Shift must be non-negative'				)
   return ((i << shift) ^ (i >> (3_2 - shift))) % 2**3_2





def lowerCamelCase__     (		__lowerCamelCase			:				bytes				):







   '''simple docstring'''




   _UpperCAmelCase  :  Dict				       =preprocess(__lowerCamelCase				)

   _UpperCAmelCase  :  Optional[Any]				       =[int(2**3_2 * abs(sin(i + 1				)				)				) for i in range(6_4				)]

   # Starting states
   _UpperCAmelCase  :  Tuple				       =0X67_45_23_01
   _UpperCAmelCase  :  Optional[int]				       =0XEF_CD_AB_89
   _UpperCAmelCase  :  str				       =0X98_BA_DC_FE
   _UpperCAmelCase  :  List[Any]				       =0X10_32_54_76

   _UpperCAmelCase  :  Any				       =[
       7,
       1_2,
       1_7,
       2_2,
       7,
       1_2,
       1_7,
       2_2,
       7,
       1_2,
       1_7,
       2_2,
       7,
       1_2,
       1_7,
       2_2,
       5,
       9,
       1_4,
       2_0,
       5,
       9,
       1_4,
       2_0,
       5,
       9,
       1_4,
       2_0,
       5,
       9,
       1_4,
       2_0,
       4,
       1_1,
       1_6,
       2_3,
       4,
       1_1,
       1_6,
       2_3,
       4,
       1_1,
       1_6,
       2_3,
       4,
       1_1,
       1_6,
       2_3,
       6,
       1_0,
       1_5,
       2_1,
       6,
       1_0,
       1_5,
       2_1,
       6,
       1_0,
       1_5,
       2_1,
       6,
       1_0,
       1_5,
       2_1,
   ]

   # Process bit string in chunks, each with 16 32-char words
   for block_words in get_block_words(__lowerCamelCase				):
      _UpperCAmelCase  :  Any				       =aa
      _UpperCAmelCase  :  Any				       =ba
      _UpperCAmelCase  :  List[str]				       =ca
      _UpperCAmelCase  :  Optional[Any]				       =da

      # Hash current chunk
      for i in range(6_4				):
         if i <= 1_5:
            # f = (b & c) | (not_32(b) & d)     # Alternate definition for f
            _UpperCAmelCase  :  str				       =d ^ (b & (c ^ d))
            _UpperCAmelCase  :  Union[str, Any]				       =i
         elif i <= 3_1:
            # f = (d & b) | (not_32(d) & c)     # Alternate definition for f
            _UpperCAmelCase  :  int				       =c ^ (d & (b ^ c))
            _UpperCAmelCase  :  Any				       =(5 * i + 1) % 1_6
         elif i <= 4_7:
            _UpperCAmelCase  :  int				       =b ^ c ^ d
            _UpperCAmelCase  :  Dict				       =(3 * i + 5) % 1_6
         else:
            _UpperCAmelCase  :  List[str]				       =c ^ (b | not_aa(__lowerCamelCase				))
            _UpperCAmelCase  :  Tuple				       =(7 * i) % 1_6
         _UpperCAmelCase  :  int				       =(f + a + added_consts[i] + block_words[g]) % 2**3_2
         _UpperCAmelCase  :  Union[str, Any]				       =d
         _UpperCAmelCase  :  Optional[Any]				       =c
         _UpperCAmelCase  :  Optional[Any]				       =b
         _UpperCAmelCase  :  Dict				       =sum_aa(__lowerCamelCase			,       left_rotate_aa(__lowerCamelCase			,       shift_amounts[i]				)				)

      # Add hashed chunk to running total
      _UpperCAmelCase  :  int				       =sum_aa(__lowerCamelCase			,       __lowerCamelCase				)
      _UpperCAmelCase  :  List[Any]				       =sum_aa(__lowerCamelCase			,       __lowerCamelCase				)
      _UpperCAmelCase  :  Any				       =sum_aa(__lowerCamelCase			,       __lowerCamelCase				)
      _UpperCAmelCase  :  Tuple				       =sum_aa(__lowerCamelCase			,       __lowerCamelCase				)

   _UpperCAmelCase  :  int				       =reformat_hex(__lowerCamelCase				) + reformat_hex(__lowerCamelCase				) + reformat_hex(__lowerCamelCase				) + reformat_hex(__lowerCamelCase				)
   return digest


if __name__ == "__main__":
 import doctest

 doctest.testmod()





'''simple docstring'''






from typing import Any

import numpy as np





def lowerCamelCase__     (		__lowerCamelCase			:				np.ndarray				):







   '''simple docstring'''




   return np.array_equal(__lowerCamelCase			,       matrix.conjugate().T				)





def lowerCamelCase__     (		__lowerCamelCase			:				np.ndarray			,       __lowerCamelCase			:				np.ndarray				):







   '''simple docstring'''




   _UpperCAmelCase  :  str				       =v.conjugate().T
   _UpperCAmelCase  :  Optional[int]				       =v_star.dot(__lowerCamelCase				)
   assert isinstance(__lowerCamelCase			,       np.ndarray				)
   return (v_star_dot.dot(__lowerCamelCase				)) / (v_star.dot(__lowerCamelCase				))





def lowerCamelCase__     (		):







   '''simple docstring'''




   _UpperCAmelCase  :  Optional[Any]				       =np.array([[2, 2 + 1J, 4], [2 - 1J, 3, 1J], [4, -1J, 1]]				)
   _UpperCAmelCase  :  List[str]				       =np.array([[1], [2], [3]]				)
   assert is_hermitian(__lowerCamelCase				), f"{a} is not hermitian."
   print(rayleigh_quotient(__lowerCamelCase			,       __lowerCamelCase				)				)

   _UpperCAmelCase  :  List[str]				       =np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]]				)
   assert is_hermitian(__lowerCamelCase				), f"{a} is not hermitian."
   assert rayleigh_quotient(__lowerCamelCase			,       __lowerCamelCase				) == float(3				)


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 tests()

