

'''simple docstring'''






from collections.abc import Generator
from math import sin


def 		_A     (    A__      ):






 """simple docstring"""



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

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


def 		_A     (    A__      ):






 """simple docstring"""



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

 __lowercase							  = format(A__     ,				'''08x'''      )[-8:]
 __lowercase							  = 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 		_A     (    A__      ):






 """simple docstring"""



 __lowercase							  = b''''''
 for char in message:
  bit_string += format(A__     ,				'''08b'''      ).encode('''utf-8'''      )
 __lowercase							  = format(len(A__      )     ,				'''064b'''      ).encode('''utf-8'''      )

 # Pad bit_string to a multiple of 512 chars
 bit_string += b"1"
 while len(A__      ) % 512 != 448:
  bit_string += b"0"
 bit_string += to_little_endian(start_len[32:]      ) + to_little_endian(start_len[:32]      )

 return bit_string


def 		_A     (    A__      ):






 """simple docstring"""



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

 for pos in range(0     ,				len(A__      )     ,				512      ):
  __lowercase							  = bit_string[pos : pos + 512]
  __lowercase							  = []
  for i in range(0     ,				512     ,				32      ):
   block_words.append(int(to_little_endian(block[i : i + 32]      )     ,				2      )      )
  yield block_words


def 		_A     (    A__      ):






 """simple docstring"""



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

 __lowercase							  = format(A__     ,				'''032b'''      )
 __lowercase							  = ''''''
 for c in i_str:
  new_str += "1" if c == "0" else "0"
 return int(A__     ,				2      )


def 		_A     (    A__     ,				A__      ):






 """simple docstring"""



 return (a + b) % 2**32


def 		_A     (    A__     ,				A__      ):






 """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 >> (32 - shift))) % 2**32


def 		_A     (    A__      ):






 """simple docstring"""



 __lowercase							  = preprocess(A__      )

 __lowercase							  = [int(2**32 * abs(sin(i + 1      )      )      ) for i in range(64      )]

 # Starting states
 __lowercase							  = 0x6745_2301
 __lowercase							  = 0xefcd_ab89
 __lowercase							  = 0x98ba_dcfe
 __lowercase							  = 0x1032_5476

 __lowercase							  = [
     7,
     12,
     17,
     22,
     7,
     12,
     17,
     22,
     7,
     12,
     17,
     22,
     7,
     12,
     17,
     22,
     5,
     9,
     14,
     20,
     5,
     9,
     14,
     20,
     5,
     9,
     14,
     20,
     5,
     9,
     14,
     20,
     4,
     11,
     16,
     23,
     4,
     11,
     16,
     23,
     4,
     11,
     16,
     23,
     4,
     11,
     16,
     23,
     6,
     10,
     15,
     21,
     6,
     10,
     15,
     21,
     6,
     10,
     15,
     21,
     6,
     10,
     15,
     21,
 ]

 # Process bit string in chunks, each with 16 32-char words
 for block_words in get_block_words(A__      ):
  __lowercase							  = aa
  __lowercase							  = ba
  __lowercase							  = ca
  __lowercase							  = da

  # Hash current chunk
  for i in range(64      ):
   if i <= 15:
    # f = (b & c) | (not_32(b) & d)     # Alternate definition for f
    __lowercase							  = d ^ (b & (c ^ d))
    __lowercase							  = i
   elif i <= 31:
    # f = (d & b) | (not_32(d) & c)     # Alternate definition for f
    __lowercase							  = c ^ (d & (b ^ c))
    __lowercase							  = (5 * i + 1) % 16
   elif i <= 47:
    __lowercase							  = b ^ c ^ d
    __lowercase							  = (3 * i + 5) % 16
   else:
    __lowercase							  = c ^ (b | not_aa(A__      ))
    __lowercase							  = (7 * i) % 16
   __lowercase							  = (f + a + added_consts[i] + block_words[g]) % 2**32
   __lowercase							  = d
   __lowercase							  = c
   __lowercase							  = b
   __lowercase							  = sum_aa(A__     ,				left_rotate_aa(A__     ,				shift_amounts[i]      )      )

  # Add hashed chunk to running total
  __lowercase							  = sum_aa(A__     ,				A__      )
  __lowercase							  = sum_aa(A__     ,				A__      )
  __lowercase							  = sum_aa(A__     ,				A__      )
  __lowercase							  = sum_aa(A__     ,				A__      )

 __lowercase							  = reformat_hex(A__      ) + reformat_hex(A__      ) + reformat_hex(A__      ) + reformat_hex(A__      )
 return digest


if __name__ == "__main__":
 import doctest

 doctest.testmod()




'''simple docstring'''






import colorsys

from PIL import Image  # type: ignore


def 		_A     (    A__     ,				A__     ,				A__      ):






 """simple docstring"""



 __lowercase							  = x
 __lowercase							  = y
 for step in range(A__      ):  # noqa: B007
  __lowercase							  = a * a - b * b + x
  __lowercase							  = 2 * a * b + y
  __lowercase							  = a_new

  # divergence happens for all complex number with an absolute value
  # greater than 4
  if a * a + b * b > 4:
   break
 return step / (max_step - 1)


def 		_A     (    A__      ):






 """simple docstring"""



 if distance == 1:
  return (0, 0, 0)
 else:
  return (255, 255, 255)


def 		_A     (    A__      ):






 """simple docstring"""



 if distance == 1:
  return (0, 0, 0)
 else:
  return tuple(round(i * 255      ) for i in colorsys.hsv_to_rgb(A__     ,				1     ,				1      )      )


def 		_A     (    A__ = 800     ,				A__ = 600     ,				A__ = -0.6     ,				A__ = 0     ,				A__ = 3.2     ,				A__ = 50     ,				A__ = True     ,				):






 """simple docstring"""



 __lowercase							  = Image.new('''RGB'''     ,				(image_width, image_height)      )
 __lowercase							  = img.load()

 # loop through the image-coordinates
 for image_x in range(A__      ):
  for image_y in range(A__      ):
   # determine the figure-coordinates based on the image-coordinates
   __lowercase							  = figure_width / image_width * image_height
   __lowercase							  = figure_center_x + (image_x / image_width - 0.5) * figure_width
   __lowercase							  = figure_center_y + (image_y / image_height - 0.5) * figure_height

   __lowercase							  = get_distance(A__     ,				A__     ,				A__      )

   # color the corresponding pixel based on the selected coloring-function
   if use_distance_color_coding:
    __lowercase							  = get_color_coded_rgb(A__      )
   else:
    __lowercase							  = get_black_and_white_rgb(A__      )

 return img


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 # colored version, full figure
 lowerCAmelCase__											=	get_image()

 # uncomment for colored version, different section, zoomed in
 # img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
 # figure_width = 0.8)

 # uncomment for black and white version, full figure
 # img = get_image(use_distance_color_coding = False)

 # uncomment to save the image
 # img.save("mandelbrot.png")

 img.show()

