



from typing import Literal

__A				    =						'''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''



def        __a     (    lowerCAmelCase_   :					str			,lowerCAmelCase_   :					str			,lowerCAmelCase_   :					Literal["encrypt", "decrypt"]				)      -> str:






						'''simple docstring'''



						UpperCAmelCase_=   LETTERS if mode == """decrypt""" else key
						UpperCAmelCase_=   key if mode == """decrypt""" else LETTERS
						UpperCAmelCase_=   """"""
						# loop through each symbol in the message
						for symbol in message:
												if symbol.upper() in chars_a:
																		# encrypt/decrypt the symbol
																		UpperCAmelCase_=   chars_a.find(symbol.upper()				)
																		if symbol.isupper():
																								translated += chars_b[sym_index].upper()
																		else:
																								translated += chars_b[sym_index].lower()
												else:
																		# symbol is not in LETTERS, just add it
																		translated += symbol
						return translated



def        __a     (    lowerCAmelCase_   :					str			,lowerCAmelCase_   :					str				)      -> str:






						'''simple docstring'''



						return translate_message(lowerCAmelCase_			,lowerCAmelCase_			,"""encrypt"""				)



def        __a     (    lowerCAmelCase_   :					str			,lowerCAmelCase_   :					str				)      -> str:






						'''simple docstring'''



						return translate_message(lowerCAmelCase_			,lowerCAmelCase_			,"""decrypt"""				)



def        __a     (    )      -> None:






						'''simple docstring'''



						UpperCAmelCase_=   """Hello World"""
						UpperCAmelCase_=   """QWERTYUIOPASDFGHJKLZXCVBNM"""
						UpperCAmelCase_=   """decrypt"""  # set to 'encrypt' or 'decrypt'

						if mode == "encrypt":
												UpperCAmelCase_=   encrypt_message(lowerCAmelCase_			,lowerCAmelCase_				)
						elif mode == "decrypt":
												UpperCAmelCase_=   decrypt_message(lowerCAmelCase_			,lowerCAmelCase_				)
						print(F"""Using the key {key}, the {mode}ed message is: {translated}"""				)


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	main()









from __future__ import annotations



def        __a     (    lowerCAmelCase_   :					int				)      -> int | None:






						'''simple docstring'''



						for r in range(1			,lowerCAmelCase_				):
												UpperCAmelCase_=   []
												for x in range(n - 1				):
																		UpperCAmelCase_=   pow(lowerCAmelCase_			,lowerCAmelCase_			,lowerCAmelCase_				)
																		if val in li:
																								break
																		li.append(lowerCAmelCase_				)
												else:
																		return r
						return None


if __name__ == "__main__":
	__A				    =						int(input('''Enter a prime number q: '''))
	__A				    =						find_primitive(q)
	if a is None:
		print(f'Cannot find the primitive for the value: {a!r}')
	else:
		__A				    =						int(input('''Enter private key of A: '''))
		__A				    =						pow(a, a_private, q)
		__A				    =						int(input('''Enter private key of B: '''))
		__A				    =						pow(a, b_private, q)

		__A				    =						pow(b_public, a_private, q)
		__A				    =						pow(a_public, b_private, q)

		print('''The key value generated by A is: ''', a_secret)
		print('''The key value generated by B is: ''', b_secret)




