

"""simple docstring"""




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



	def __init__(   self			:    Any       ,  _lowercase			:    Dict		):
		__UpperCAmelCase							=      data
		__UpperCAmelCase							=      [0X6_7_4_5_2_3_0_1, 0XE_F_C_D_A_B_8_9, 0X9_8_B_A_D_C_F_E, 0X1_0_3_2_5_4_7_6, 0XC_3_D_2_E_1_F_0]



	@staticmethod
	def     a   (   _lowercase			:    Union[str, Any]       ,  _lowercase			:    int		):
		return ((n << b) | (n >> (32 - b))) & 0XF_F_F_F_F_F_F_F



	def     a   (   self			:    List[Any]		):
		__UpperCAmelCase							=      b'''\x80''' + b'''\x00''' * (63 - (len(self.data		) + 8) % 64)
		__UpperCAmelCase							=      self.data + padding + struct.pack('''>Q'''       ,  8 * len(self.data		)		)
		return padded_data



	def     a   (   self			:    Dict		):
		return [
		    self.padded_data[i : i + 64] for i in range(0       ,  len(self.padded_data		)       ,  64		)
		]



	def     a   (   self			:    str       ,  _lowercase			:    List[str]		):
		__UpperCAmelCase							=      list(struct.unpack('''>16L'''       ,  UpperCamelCase__		)		) + [0] * 64
		for i in range(16       ,  80		):
			__UpperCAmelCase							=      self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16])       ,  1		)
		return w



	def     a   (   self			:    int		):
		__UpperCAmelCase							=      self.padding()
		__UpperCAmelCase							=      self.split_blocks()
		for block in self.blocks:
			__UpperCAmelCase							=      self.expand_block(UpperCamelCase__		)
			__UpperCAmelCase						,				__UpperCAmelCase						,				__UpperCAmelCase						,				__UpperCAmelCase						,				__UpperCAmelCase							=      self.h
			for i in range(0       ,  80		):
				if 0 <= i < 20:
					__UpperCAmelCase							=      (b & c) | ((~b) & d)
					__UpperCAmelCase							=      0X5_A_8_2_7_9_9_9
				elif 20 <= i < 40:
					__UpperCAmelCase							=      b ^ c ^ d
					__UpperCAmelCase							=      0X6_E_D_9_E_B_A_1
				elif 40 <= i < 60:
					__UpperCAmelCase							=      (b & c) | (b & d) | (c & d)
					__UpperCAmelCase							=      0X8_F_1_B_B_C_D_C
				elif 60 <= i < 80:
					__UpperCAmelCase							=      b ^ c ^ d
					__UpperCAmelCase							=      0XC_A_6_2_C_1_D_6
				__UpperCAmelCase						,				__UpperCAmelCase						,				__UpperCAmelCase						,				__UpperCAmelCase						,				__UpperCAmelCase							=      (
				    self.rotate(UpperCamelCase__       ,  5		) + f + e + k + expanded_block[i] & 0XF_F_F_F_F_F_F_F,
				    a,
				    self.rotate(UpperCamelCase__       ,  30		),
				    c,
				    d,
				)
			__UpperCAmelCase							=      (
			    self.h[0] + a & 0XF_F_F_F_F_F_F_F,
			    self.h[1] + b & 0XF_F_F_F_F_F_F_F,
			    self.h[2] + c & 0XF_F_F_F_F_F_F_F,
			    self.h[3] + d & 0XF_F_F_F_F_F_F_F,
			    self.h[4] + e & 0XF_F_F_F_F_F_F_F,
			)
		return ("{:08x}" * 5).format(*self.h		)






def 	lowercase__		(    ):
	__UpperCAmelCase							=      b'''Test String'''
	assert SHAaHash(_A  ).final_hash() == hashlib.shaa(_A  ).hexdigest()  # noqa: S324





def 	lowercase__		(    ):
	__UpperCAmelCase							=      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'''  )
	__UpperCAmelCase							=      parser.parse_args()
	__UpperCAmelCase							=      args.input_string
	# In any case hash input should be a bytestring
	if args.input_file:
		with open(args.input_file       ,						'''rb'''  ) as f:
			__UpperCAmelCase							=      f.read()
	else:
		__UpperCAmelCase							=      bytes(_A       ,						'''utf-8'''  )
	print(SHAaHash(_A  ).final_hash()  )


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

				doctest.testmod()






import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute





def __UpperCamelCase			(       _A = 3  ):
						if isinstance(_A ,  _A  ):
												raise TypeError('''number of qubits must be a integer.'''  )
						if number_of_qubits <= 0:
												raise ValueError('''number of qubits must be > 0.'''  )
						if math.floor(_A  ) != number_of_qubits:
												raise ValueError('''number of qubits must be exact integer.'''  )
						if number_of_qubits > 10:
												raise ValueError('''number of qubits too large to simulate(>10).'''  )

						lowerCAmelCase_      			=  QuantumRegister(_A ,  '''qr'''  )
						lowerCAmelCase_      			=  ClassicalRegister(_A ,  '''cr'''  )

						lowerCAmelCase_      			=  QuantumCircuit(_A ,  _A  )

						lowerCAmelCase_      			=  number_of_qubits

						for i in range(_A  ):
												quantum_circuit.h(number_of_qubits - i - 1  )
												counter -= 1
												for j in range(_A  ):
																		quantum_circuit.cp(np.pi / 2 ** (counter - j) ,  _A ,  _A  )

						for k in range(number_of_qubits // 2  ):
												quantum_circuit.swap(_A ,  number_of_qubits - k - 1  )

						# measure all the qubits
						quantum_circuit.measure(_A ,  _A  )
						# simulate with 10000 shots
						lowerCAmelCase_      			=  Aer.get_backend('''qasm_simulator'''  )
						lowerCAmelCase_      			=  execute(_A ,  _A ,  shots=10000  )

						return job.result().get_counts(_A  )


if __name__ == "__main__":
						print(
						    f"Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}"
						)




