


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







class 				snake_case__:







						'''simple docstring'''




						def __init__(				self   ,						__lowercase							)					->    List[Any]:
										lowerCAmelCase_ :      Tuple    				=				data
										lowerCAmelCase_ :      Any    				=				[0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]




						@staticmethod
						def 						lowercase_ (				__lowercase   ,						__lowercase							)					->    Optional[int]:
										return ((n << b) | (n >> (3_2 - b))) & 0xFFFFFFFF




						def 						lowercase_ (				self							)					->    List[str]:
										lowerCAmelCase_ :      Dict    				=				B'''\x80''' + B'''\x00''' * (6_3 - (len(self.data							) + 8) % 6_4)
										lowerCAmelCase_ :      Tuple    				=				self.data + padding + struct.pack('''>Q'''   ,						8 * len(self.data							)							)
										return padded_data




						def 						lowercase_ (				self							)					->    List[str]:
										return [
										    self.padded_data[i : i + 6_4] for i in range(0   ,						len(self.padded_data							)   ,						6_4							)
										]




						def 						lowercase_ (				self   ,						__lowercase							)					->    List[str]:
										lowerCAmelCase_ :      str    				=				list(struct.unpack('''>16L'''   ,						__lowercase							)							) + [0] * 6_4
										for i in range(1_6   ,						8_0							):
														lowerCAmelCase_ :      List[str]    				=				self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 1_4] ^ w[i - 1_6])   ,						1							)
										return w




						def 						lowercase_ (				self							)					->    Any:
										lowerCAmelCase_ :      Optional[int]    				=				self.padding()
										lowerCAmelCase_ :      str    				=				self.split_blocks()
										for block in self.blocks:
														lowerCAmelCase_ :      int    				=				self.expand_block(__lowercase							)
														lowerCAmelCase_				,  lowerCAmelCase_				,  lowerCAmelCase_				,  lowerCAmelCase_				,  lowerCAmelCase_ :      Optional[int]    				=				self.h
														for i in range(0   ,						8_0							):
																		if 0 <= i < 2_0:
																						lowerCAmelCase_ :      str    				=				(b & c) | ((~b) & d)
																						lowerCAmelCase_ :      Any    				=				0x5A827999
																		elif 2_0 <= i < 4_0:
																						lowerCAmelCase_ :      List[Any]    				=				b ^ c ^ d
																						lowerCAmelCase_ :      Any    				=				0x6ED9EBA1
																		elif 4_0 <= i < 6_0:
																						lowerCAmelCase_ :      Optional[int]    				=				(b & c) | (b & d) | (c & d)
																						lowerCAmelCase_ :      Optional[int]    				=				0x8F1BBCDC
																		elif 6_0 <= i < 8_0:
																						lowerCAmelCase_ :      List[str]    				=				b ^ c ^ d
																						lowerCAmelCase_ :      str    				=				0xCA62C1D6
																		lowerCAmelCase_				,  lowerCAmelCase_				,  lowerCAmelCase_				,  lowerCAmelCase_				,  lowerCAmelCase_ :      int    				=				(
																		    self.rotate(__lowercase   ,						5							) + f + e + k + expanded_block[i] & 0xFFFFFFFF,
																		    a,
																		    self.rotate(__lowercase   ,						3_0							),
																		    c,
																		    d,
																		)
														lowerCAmelCase_ :      Tuple    				=				(
														    self.h[0] + a & 0xFFFFFFFF,
														    self.h[1] + b & 0xFFFFFFFF,
														    self.h[2] + c & 0xFFFFFFFF,
														    self.h[3] + d & 0xFFFFFFFF,
														    self.h[4] + e & 0xFFFFFFFF,
														)
										return ("{:08x}" * 5).format(*self.h							)






def 			lowerCAmelCase (		)-> Optional[int]:
				lowerCAmelCase_ :      Optional[int]    				=				B'''Test String'''
				assert SHAaHash(lowerCAmelCase_ ).final_hash() == hashlib.shaa(lowerCAmelCase_ ).hexdigest()  # noqa: S324



def 			lowerCAmelCase (		)-> Optional[int]:
				lowerCAmelCase_ :      List[Any]    				=				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''' )
				lowerCAmelCase_ :      List[Any]    				=				parser.parse_args()
				lowerCAmelCase_ :      Dict    				=				args.input_string
				# In any case hash input should be a bytestring
				if args.input_file:
								with open(args.input_file ,   '''rb''' ) as f:
												lowerCAmelCase_ :      List[str]    				=				f.read()
				else:
								lowerCAmelCase_ :      Optional[int]    				=				bytes(lowerCAmelCase_ ,   '''utf-8''' )
				print(SHAaHash(lowerCAmelCase_ ).final_hash() )


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

						doctest.testmod()



import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Audio, Features, Value
from .base import TaskTemplate







@dataclass(frozen=UpperCAmelCase__							)
class 				snake_case__(							UpperCAmelCase__							):







						'''simple docstring'''




						SCREAMING_SNAKE_CASE__      :  str					=							field(default="""automatic-speech-recognition""",						metadata={"""include_in_asdict_even_if_is_default""": True}							)
						SCREAMING_SNAKE_CASE__      :  ClassVar[Features]					=							Features({"""audio""": Audio()}							)
						SCREAMING_SNAKE_CASE__      :  ClassVar[Features]					=							Features({"""transcription""": Value("""string"""							)}							)
						SCREAMING_SNAKE_CASE__      :  str					=							"audio"
						SCREAMING_SNAKE_CASE__      :  str					=							"transcription"




						def 						lowercase_ (				self   ,						__lowercase							)					->    int:
										if self.audio_column not in features:
														raise ValueError(f"""Column {self.audio_column} is not present in features."""							)
										if not isinstance(features[self.audio_column]   ,						__lowercase							):
														raise ValueError(f"""Column {self.audio_column} is not an Audio type."""							)
										lowerCAmelCase_ :      List[str]    				=				copy.deepcopy(self							)
										lowerCAmelCase_ :      Optional[Any]    				=				self.input_schema.copy()
										lowerCAmelCase_ :      Optional[Any]    				=				features[self.audio_column]
										lowerCAmelCase_ :      List[str]    				=				input_schema
										return task_template




						@property
						def 						lowercase_ (				self							)					->    Dict[str, str]:
										return {self.audio_column: "audio", self.transcription_column: "transcription"}