



'''simple docstring'''




import requests

try:
							from django.contrib.auth import authenticate, login
							from django.shortcuts import redirect, render
except ImportError:
							a  :     Optional[int]       =       print



def  __lowerCamelCase    (   _lowercase						) ->     int:
							# Enter your recaptcha secret key here
							UpperCAmelCase	:						int					=						"""secretKey"""
							UpperCAmelCase	:						Dict					=						"""https://www.google.com/recaptcha/api/siteverify"""

							# when method is not POST, direct user to login page
							if request.method != "POST":
														return render(_lowercase      ,							"""login.html"""						)

							# from the frontend, get username, password, and client_key
							UpperCAmelCase	:						Dict					=						request.POST.get("""username"""						)
							UpperCAmelCase	:						Optional[Any]					=						request.POST.get("""password"""						)
							UpperCAmelCase	:						List[str]					=						request.POST.get("""g-recaptcha-response"""						)

							# post recaptcha response to Google's recaptcha api
							UpperCAmelCase	:						Union[str, Any]					=						requests.post(_lowercase      ,							data={"""secret""": secret_key, """response""": client_key}						)
							# if the recaptcha api verified our keys
							if response.json().get("""success"""      ,							_lowercase						):
														# authenticate the user
														UpperCAmelCase	:						List[Any]					=						authenticate(_lowercase      ,							username=_lowercase      ,							password=_lowercase						)
														if user_in_database:
																					login(_lowercase      ,							_lowercase						)
																					return redirect("""/your-webpage"""						)
							return render(_lowercase      ,							"""login.html"""						)






'''simple docstring'''




from __future__ import annotations



def  __lowerCamelCase    (   _lowercase						) ->     int | None:
							for r in range(1      ,							_lowercase						):
														UpperCAmelCase	:						Dict					=						[]
														for x in range(n - 1						):
																					UpperCAmelCase	:						List[str]					=						pow(_lowercase      ,							_lowercase      ,							_lowercase						)
																					if val in li:
																												break
																					li.append(_lowercase						)
														else:
																					return r
							return None


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

														a  :     Union[str, Any]       =       pow(b_public, a_private, q)
														a  :     List[Any]       =       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)

