





from collections.abc import Generator
from math import sin





def 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__ )  ->				bytes:







			'''simple docstring'''

			if len(UpperCamelCase__ ) != 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 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__ )  ->				bytes:







			'''simple docstring'''

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

			UpperCAmelCase   		=				format(UpperCamelCase__			,			'''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 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__ )  ->				bytes:







			'''simple docstring'''

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

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

			return bit_string





def 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__ )  ->				Generator[list[int], None, None]:







			'''simple docstring'''

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

			for pos in range(0			,			len(UpperCamelCase__ )			,			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 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__ )  ->				int:







			'''simple docstring'''

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

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





def 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__			,			UpperCamelCase__ )  ->				int:







			'''simple docstring'''

			return (a + b) % 2**32





def 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__			,			UpperCamelCase__ )  ->				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 >> (32 - shift))) % 2**32





def 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__ )  ->				bytes:







			'''simple docstring'''

			UpperCAmelCase   		=				preprocess(UpperCamelCase__ )

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

			# Starting states
			UpperCAmelCase   		=				0X67452301
			UpperCAmelCase   		=				0XEFCDAB89
			UpperCAmelCase   		=				0X98BADCFE
			UpperCAmelCase   		=				0X10325476

			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(UpperCamelCase__ ):
						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(UpperCamelCase__ ))
												UpperCAmelCase   		=				(7 * i) % 16
									UpperCAmelCase   		=				(f + a + added_consts[i] + block_words[g]) % 2**32
									UpperCAmelCase   		=				d
									UpperCAmelCase   		=				c
									UpperCAmelCase   		=				b
									UpperCAmelCase   		=				sum_aa(UpperCamelCase__			,			left_rotate_aa(UpperCamelCase__			,			shift_amounts[i] ) )

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

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


if __name__ == "__main__":
				import doctest

				doctest.testmod()










from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_tf_available,
    is_torch_available,
)


__A				:    Union[str, Any]       =   {
    "configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Speech2TextConfig"],
    "processing_speech_to_text": ["Speech2TextProcessor"],
}

try:
				if not is_sentencepiece_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__A				:    List[Any]       =   ["Speech2TextTokenizer"]

try:
				if not is_speech_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__A				:    List[Any]       =   ["Speech2TextFeatureExtractor"]

try:
				if not is_tf_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__A				:    int       =   [
				    "TF_SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST",
				    "TFSpeech2TextForConditionalGeneration",
				    "TFSpeech2TextModel",
				    "TFSpeech2TextPreTrainedModel",
				]

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__A				:    Tuple       =   [
				    "SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST",
				    "Speech2TextForConditionalGeneration",
				    "Speech2TextModel",
				    "Speech2TextPreTrainedModel",
				]


if TYPE_CHECKING:
				from .configuration_speech_to_text import SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP, SpeechaTextConfig
				from .processing_speech_to_text import SpeechaTextProcessor

				try:
								if not is_sentencepiece_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_speech_to_text import SpeechaTextTokenizer

				try:
								if not is_speech_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .feature_extraction_speech_to_text import SpeechaTextFeatureExtractor

				try:
								if not is_tf_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_tf_speech_to_text import (
								    TF_SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
								    TFSpeechaTextForConditionalGeneration,
								    TFSpeechaTextModel,
								    TFSpeechaTextPreTrainedModel,
								)

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_speech_to_text import (
								    SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
								    SpeechaTextForConditionalGeneration,
								    SpeechaTextModel,
								    SpeechaTextPreTrainedModel,
								)

else:
				import sys

				__A				:    Dict       =   _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



