\documentclass[11pt]{article}
\input{headers04}

\usepackage{fancyhdr}   
\pagestyle{fancy}      
\lhead{CS 355, Fall 2026}
\rhead{Name: Hemanta K. Maji} %%% <-- REPLACE Hemanta K. Maji WITH YOUR NAME HERE

\usepackage[strict]{changepage}  
\newcommand{\nextoddpage}{\checkoddpage\ifoddpage{\ \newpage\ \newpage}\else{\ \newpage}\fi}  


\begin{document}

\title{Homework 4}

\date{}

\maketitle 

\thispagestyle{fancy}
\pagestyle{fancy}      

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%% PLEASE LIST COLLABORATORS BELOW  %%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\bfseries Collaborators :} 
%%% List your collaborators and any online resources here.



\newpage
\centering
{\Huge{Practice Questions}}

These are practice questions.
They will \textbf{NOT} be graded.
We have also provided the final answers.
However, it is up to you to understand how or why the given solution is correct.

You do not need to submit these on Gradescope.
However, you may find it easier to just include them in the pdf.
In that case, please do not mark these questions on Gradescope.

\newpage

\begin{enumerate}
	\item {\bfseries An Example of Extended GCD Algorithm (20 points).}
	      Recall that the extended GCD algorithm takes as input two integers $a, b$ and returns a triple $(g, \alpha, \beta)$, such that 
	      $$g = \gcd(a,b), \text{ and } g = \alpha \cdot a + \beta \cdot b.$$ 
	      Here $+$ and $\cdot$ are integer addition and multiplication operations, respectively. 
	          
	      Find $(g, \alpha, \beta)$ when $a = 2025, b = 373$. 
	          
	      {\bfseries Solution.}  
	      
	      $$\left(g, \alpha, \beta\right) = \left(1, 7, -38\right)$$
	          
	      \newpage
	      
	\item {\bfseries Finding Inverse Using Extended GCD Algorithm (20 points).}
	      In this problem, we shall work over the group $(\bbZ_{509}^*,\times)$. 
	      Note that $509$ is a prime. 
	      The multiplication operation $\times$ is ``integer multiplication $\mod 509$.'' 
	         
	      Use the Extended GCD algorithm to find the multiplicative inverse of $20$ in the group $(\bbZ_{509}^*,\times)$.
	         
	      {\bfseries Solution.}  
	      
	      The inverse of 20 in the group $(\bbZ_{509}^*,\times)$ is 280.
	          
	      \newpage 
\end{enumerate}





\newpage
\centering
{\Huge{Homework Questions}}

These are homework questions and will be graded.
Please make sure to clearly mark each problem on Gradescope.
\newpage

\begin{enumerate}
	
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%%%%%%%%% PROBLEM 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\item {\bfseries Asymptotics and Efficient Algorithms (20 points).}  
	      Suppose a cryptographic protocol $P_n$ is implemented using $\alpha n^2$ CPU instructions. We expect the protocol to be broken with $\beta 2^{n/10}$ CPU instructions. $\alpha$ and $\beta$ are some positive constants, while $n$ is the parameter of the protocol (such as key length in bits). That is, when we set the parameter $n = \sigma$, to use the protocol, the ``good guys'' need to run $\alpha {\sigma}^2$ CPU instructions. While to break the protocol, the ``bad guys'' need to run $\beta 2^{\sigma/10}$ CPU instructions.
	        
	      Suppose, today, everyone in the world uses the primitive $P_n$ using $n=n_0$, a constant value such that even if the entire computing resources of the world were put together for 8 years, we cannot compute $\beta 2^{n_0/10}$ CPU instructions. 
	        
	      Assume Moore's law holds. 
	      That is, every two years, the amount of CPU instructions a CPU can run per second doubles. 
	      
	      {\em Remark}: This problem explains why we demand that our cryptographic algorithms run in polynomial time and that it be exponentially difficult for adversaries to break the cryptographic protocols.
	        
	      \begin{enumerate}
	      	\item (5 points) Assuming Moore's law, how much faster will the CPUs be 8 years into the future compared to now?
	      	      
	      	      {\bfseries Solution.}
	      	      
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	      \vfill
	      	      
	      	\item (5 points) At the end of 8 years, what choice of $n_1$ will ensure that the protocol $P_n$ for $n=n_1$ cannot be broken for another 8 years? (Recall that currently, setting $n=n_0$ ensures that the adversaries need to run $\beta 2^{n_0/10}$ instructions to break the protocol, which they are unable to do even in $8$ years.)
	      	      
	      	      Intuition: Since future computers (8 years later from today) are now faster (based on your answer in part (a)), we need to set our parameters to a larger value to ensure that security still holds. Your task is to determine how large this new parameter $n_1$ needs to be compared to the current parameter $n_0$. Your answer should be an equation for $n_1$, in terms of $n_0$ and/or other variables.
	      	      
	      	      Hint: Start by assuming that, today, the entire computing resources of the world can run $W$ instructions over an 8-year period. Eight years from now, the same resources will run $x\cdot W$ instructions over an 8-year period, where $x$ is your answer to part (a).
	      	      
	      	      {\bfseries Solution.}
	      	          
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	      \vfill
	      	      
	      	      \newpage  
	      	      
	      	\item (5 points) What will be the run-time of the protocol $P_n$ using $n=n_1$ on the \underline{new computers} as compared to the run-time of the protocol $P_n$ using $n=n_0$ on today's computers? (Recall that $P_n$ is implemented using $\alpha n^2$ CPU instructions.)
	      	      
	      	      Hint: Start by assuming that an honest party's computer today is able to run $\Gamma$ instructions per second. (This $\Gamma$ is unrelated to the $W$ of part (b).)
	      	      
	      	      Your answer should be a ratio of the new run time divided by the old run time.
	      	      
	      	      {\bfseries Solution.}
	      	          
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	      \vfill
	      	        
	      	\item (5 points) What will be the run-time of the protocol $P_n$ using $n=n_1$ on today's computers as compared to the run-time of the protocol $P_n$ using $n=n_0$ on \underline{today's computers}? (Recall that $P_n$ is implemented using $\alpha n^2$ CPU instructions.)
	      	      
	      	      Your answer should be a ratio of the new run time divided by the old run time.
	      	      
	      	      {\bfseries Solution.}
	      	      
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	      \vfill
	      	          
	      \end{enumerate}
	      \newpage
	      
	      
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%% PROBLEM 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\item {\bfseries Another Application of Extended GCD Algorithm (20 points).}
	      Use the Extended GCD algorithm to find $x \in \{0,1,2,\dots, 949\}$ that satisfies the following two equations. 
	      \begin{align*}
	      	x & = 6\mod 25  \\
	      	x & = 9 \mod 38 
	      \end{align*}
	      Note that $25$ and $38$ are \ul{not} primes. 
	      However, we have the guarantee that $25$ and $38$ are relatively prime, that is, $\gcd(25,38)=1$. 
	      Also, note that the number $949 = 25\cdot38-1$. 
	         
	      {\bfseries Solution.}  
	      
	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	          
	      \newpage
	      
	        
	        
	       
	        
	         
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%% PROBLEM 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      
	\item {\bfseries Square Root of an Element (20 points).} 
	      Let $p$ be a prime such that $p=3\mod 4$. 
	      For example, $p\in\{3,7,11,19,\dotsc\}$.
	        
	      We say that $x$ is a square-root of $a$ in the group $(\bbZ_p^*,\times)$ if $x^2 = a\mod p$. 
	      We say that $a\in \bbZ_p^*$ is a quadratic residue if $a=x^2 \mod{p}$ for some $x\in \bbZ_p^*$. 
	      Prove that if $a\in \bbZ_p^*$ is a quadratic residue then $a^{(p+1)/4}$ is a square-root of $a$.
	        
	      (Remark: This statement is only true if we assume that $a$ is a quadratic residue. For example, when $p=7$, 3 is not a quadratic residue, so $3^{(7+1)/4}$ is not a square root of 3.)
	        
	        
	      {\bfseries Solution.}  
	          
	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      
	      
	      \newpage
	      
	      
	      
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\item {\bfseries Lagrange Interpolation (10 points).}
	      Consider distinct $x_1, x_2, \dotsc, x_d\in F$, where $F$ is a finite field. 
	      Prove the identity:
	      $$ \sum_{i=1}^d \quad \prod_{j\in\{1,2,\dotsc,d\}\setminus\{i\}} \frac{x_j}{(x_j-x_i)} = 1. $$

          Hint: We know that there is a unique polynomial of degree at most $d-1$ that passes through $d$ distinct points $(x_1,1),(x_2,1),\dots,(x_d,1)$ where $1\in F$.
        Can you think of a (simple) polynomial that passes through all these points?
        What if you try to interpolate this polynomial using Lagrange interpolation?
        What does the formula give you?
	      
	      {\bfseries Solution.}
	      
	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	           
	           
\end{enumerate}
\newpage


\end{document}
