



from collections.abc import Generator
from math import sin

def    lowerCamelCase_(lowerCamelCase_    ) ->       bytes:
						if len(lowerCamelCase_    ) != 32:
												raise ValueError("Input must be of length 32"    )

						UpperCAmelCase         =     B""
						for i in [3, 2, 1, 0]:
												little_endian += string_aa[8 * i : 8 * i + 8]
						return little_endian

def    lowerCamelCase_(lowerCamelCase_    ) ->       bytes:
						if i < 0:
												raise ValueError("Input must be non-negative"    )

						UpperCAmelCase         =     format(lowerCamelCase_    ,   "08x"    )[-8:]
						UpperCAmelCase         =     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:
						UpperCAmelCase         =     B""
						for char in message:
												bit_string += format(lowerCamelCase_    ,   "08b"    ).encode("utf-8"    )
						UpperCAmelCase         =     format(len(lowerCamelCase_    )    ,   "064b"    ).encode("utf-8"    )

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

						return bit_string

def    lowerCamelCase_(lowerCamelCase_    ) ->       Generator[list[int], None, None]:
						if len(lowerCamelCase_    ) % 512 != 0:
												raise ValueError("Input must have length that's a multiple of 512"    )

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

def    lowerCamelCase_(lowerCamelCase_    ) ->       int:
						if i < 0:
												raise ValueError("Input must be non-negative"    )

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

def    lowerCamelCase_(lowerCamelCase_    ,   lowerCamelCase_    ) ->       int:
						return (a + b) % 2**32

def    lowerCamelCase_(lowerCamelCase_    ,   lowerCamelCase_    ) ->       int:
						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    lowerCamelCase_(lowerCamelCase_    ) ->       bytes:
						UpperCAmelCase         =     preprocess(lowerCamelCase_    )

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

						# Starting states
						UpperCAmelCase         =     0X6745_2301
						UpperCAmelCase         =     0XEFCD_AB89
						UpperCAmelCase         =     0X98BA_DCFE
						UpperCAmelCase         =     0X1032_5476

						UpperCAmelCase         =     [
						    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(lowerCamelCase_    ):
												UpperCAmelCase         =     aa
												UpperCAmelCase         =     ba
												UpperCAmelCase         =     ca
												UpperCAmelCase         =     da

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

												# Add hashed chunk to running total
												UpperCAmelCase         =     sum_aa(lowerCamelCase_    ,   lowerCamelCase_    )
												UpperCAmelCase         =     sum_aa(lowerCamelCase_    ,   lowerCamelCase_    )
												UpperCAmelCase         =     sum_aa(lowerCamelCase_    ,   lowerCamelCase_    )
												UpperCAmelCase         =     sum_aa(lowerCamelCase_    ,   lowerCamelCase_    )

						UpperCAmelCase         =     reformat_hex(lowerCamelCase_    ) + reformat_hex(lowerCamelCase_    ) + reformat_hex(lowerCamelCase_    ) + reformat_hex(lowerCamelCase_    )
						return digest


if __name__ == "__main__":
		import doctest

		doctest.testmod()








from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    center_crop,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


if is_vision_available():
		import PIL


__lowerCamelCase     :							List[Any]  							=				logging.get_logger(__name__)





class  __magic_name__   (							A__						):
		lowercase      :       Tuple          =['''pixel_values''']






		def __init__(						self      :     Any				,		UpperCamelCase__      :     bool = True				,		UpperCamelCase__      :     Dict[str, int] = None				,		UpperCamelCase__      :     float = None				,		UpperCamelCase__      :     PILImageResampling = PILImageResampling.BILINEAR				,		UpperCamelCase__      :     bool = True				,		UpperCamelCase__      :     Union[int, float] = 1 / 2_55				,		UpperCamelCase__      :     bool = True				,		UpperCamelCase__      :     Optional[Union[float, List[float]]] = None				,		UpperCamelCase__      :     Optional[Union[float, List[float]]] = None				,		**UpperCamelCase__      :     List[str]				,		)				->					None:
								'''simple docstring'''







								super().__init__(**UpperCamelCase__      )
								UpperCAmelCase         =     size if size is not None else {"shortest_edge": 3_84}
								UpperCAmelCase         =     get_size_dict(UpperCamelCase__				,		default_to_square=UpperCamelCase__      )

								UpperCAmelCase         =     do_resize
								UpperCAmelCase         =     size
								# Default value set here for backwards compatibility where the value in config is None
								UpperCAmelCase         =     crop_pct if crop_pct is not None else 2_24 / 2_56
								UpperCAmelCase         =     resample
								UpperCAmelCase         =     do_rescale
								UpperCAmelCase         =     rescale_factor
								UpperCAmelCase         =     do_normalize
								UpperCAmelCase         =     image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
								UpperCAmelCase         =     image_std if image_std is not None else IMAGENET_STANDARD_STD






		def SCREAMING_SNAKE_CASE_			(						self      :     Any				,		UpperCamelCase__      :     np.ndarray				,		UpperCamelCase__      :     Dict[str, int]				,		UpperCamelCase__      :     float				,		UpperCamelCase__      :     PILImageResampling = PILImageResampling.BICUBIC				,		UpperCamelCase__      :     Optional[Union[str, ChannelDimension]] = None				,		**UpperCamelCase__      :     Union[str, Any]				,		)				->					np.ndarray:
								'''simple docstring'''







								UpperCAmelCase         =     get_size_dict(UpperCamelCase__				,		default_to_square=UpperCamelCase__      )
								if "shortest_edge" not in size:
														raise ValueError(F'Size dictionary must contain \'shortest_edge\' key. Got {size.keys()}'      )
								UpperCAmelCase         =     size["shortest_edge"]

								if shortest_edge < 3_84:
														# maintain same ratio, resizing shortest edge to shortest_edge/crop_pct
														UpperCAmelCase         =     int(shortest_edge / crop_pct      )
														UpperCAmelCase         =     get_resize_output_image_size(UpperCamelCase__				,		size=UpperCamelCase__				,		default_to_square=UpperCamelCase__      )
														UpperCAmelCase         =     resize(image=UpperCamelCase__				,		size=UpperCamelCase__				,		resample=UpperCamelCase__				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )
														# then crop to (shortest_edge, shortest_edge)
														return center_crop(image=UpperCamelCase__				,		size=(shortest_edge, shortest_edge)				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )
								else:
														# warping (no cropping) when evaluated at 384 or larger
														return resize(
														    UpperCamelCase__				,		size=(shortest_edge, shortest_edge)				,		resample=UpperCamelCase__				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )






		def SCREAMING_SNAKE_CASE_			(						self      :     Optional[Any]				,		UpperCamelCase__      :     np.ndarray				,		UpperCamelCase__      :     Union[int, float]				,		UpperCamelCase__      :     Optional[Union[str, ChannelDimension]] = None				,		**UpperCamelCase__      :     Optional[Any]				,		)				->					List[str]:
								'''simple docstring'''







								return rescale(UpperCamelCase__				,		scale=UpperCamelCase__				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )






		def SCREAMING_SNAKE_CASE_			(						self      :     List[str]				,		UpperCamelCase__      :     np.ndarray				,		UpperCamelCase__      :     Union[float, List[float]]				,		UpperCamelCase__      :     Union[float, List[float]]				,		UpperCamelCase__      :     Optional[Union[str, ChannelDimension]] = None				,		**UpperCamelCase__      :     Optional[Any]				,		)				->					np.ndarray:
								'''simple docstring'''







								return normalize(UpperCamelCase__				,		mean=UpperCamelCase__				,		std=UpperCamelCase__				,		data_format=UpperCamelCase__				,		**UpperCamelCase__      )







		def SCREAMING_SNAKE_CASE_			(						self      :     Tuple				,		UpperCamelCase__      :     ImageInput				,		UpperCamelCase__      :     bool = None				,		UpperCamelCase__      :     Dict[str, int] = None				,		UpperCamelCase__      :     float = None				,		UpperCamelCase__      :     PILImageResampling = None				,		UpperCamelCase__      :     bool = None				,		UpperCamelCase__      :     float = None				,		UpperCamelCase__      :     bool = None				,		UpperCamelCase__      :     Optional[Union[float, List[float]]] = None				,		UpperCamelCase__      :     Optional[Union[float, List[float]]] = None				,		UpperCamelCase__      :     Optional[Union[str, TensorType]] = None				,		UpperCamelCase__      :     ChannelDimension = ChannelDimension.FIRST				,		**UpperCamelCase__      :     Any				,		)				->					PIL.Image.Image:
								'''simple docstring'''







								UpperCAmelCase         =     do_resize if do_resize is not None else self.do_resize
								UpperCAmelCase         =     crop_pct if crop_pct is not None else self.crop_pct
								UpperCAmelCase         =     resample if resample is not None else self.resample
								UpperCAmelCase         =     do_rescale if do_rescale is not None else self.do_rescale
								UpperCAmelCase         =     rescale_factor if rescale_factor is not None else self.rescale_factor
								UpperCAmelCase         =     do_normalize if do_normalize is not None else self.do_normalize
								UpperCAmelCase         =     image_mean if image_mean is not None else self.image_mean
								UpperCAmelCase         =     image_std if image_std is not None else self.image_std

								UpperCAmelCase         =     size if size is not None else self.size
								UpperCAmelCase         =     get_size_dict(UpperCamelCase__				,		default_to_square=UpperCamelCase__      )

								UpperCAmelCase         =     make_list_of_images(UpperCamelCase__      )

								if not valid_images(UpperCamelCase__      ):
														raise ValueError(
														    "Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, "
														    "torch.Tensor, tf.Tensor or jax.ndarray."      )

								if do_resize and size is None or resample is None:
														raise ValueError("Size and resample must be specified if do_resize is True."      )

								if do_resize and size["shortest_edge"] < 3_84 and crop_pct is None:
														raise ValueError("crop_pct must be specified if size < 384."      )

								if do_rescale and rescale_factor is None:
														raise ValueError("Rescale factor must be specified if do_rescale is True."      )

								if do_normalize and (image_mean is None or image_std is None):
														raise ValueError("Image mean and std must be specified if do_normalize is True."      )

								# All transformations expect numpy arrays.
								UpperCAmelCase         =     [to_numpy_array(UpperCamelCase__      ) for image in images]

								if do_resize:
														UpperCAmelCase         =     [self.resize(image=UpperCamelCase__				,		size=UpperCamelCase__				,		crop_pct=UpperCamelCase__				,		resample=UpperCamelCase__      ) for image in images]

								if do_rescale:
														UpperCAmelCase         =     [self.rescale(image=UpperCamelCase__				,		scale=UpperCamelCase__      ) for image in images]

								if do_normalize:
														UpperCAmelCase         =     [self.normalize(image=UpperCamelCase__				,		mean=UpperCamelCase__				,		std=UpperCamelCase__      ) for image in images]

								UpperCAmelCase         =     [to_channel_dimension_format(UpperCamelCase__				,		UpperCamelCase__      ) for image in images]

								UpperCAmelCase         =     {"pixel_values": images}
								return BatchFeature(data=UpperCamelCase__				,		tensor_type=UpperCamelCase__      )



