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

\usepackage{fancyhdr}   
\pagestyle{fancy}      
\lhead{CS 355, Fall 2025}               
\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 it is 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 setting $n=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}$ instruction 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 securities still hold. 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 the old computers are able to run $\Gamma$ instruction over an 8-year period. And the new computers are able to run $x\cdot\Gamma$ instruction over an 8-year period.

    {\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 today computers are able to run $\Gamma$ instructions per second.

    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, 671\}$ that satisfies the following two equations. 
\begin{align*}
    x &= 3\mod 21\\
    x &= 4 \mod 32
\end{align*}
Note that $21$ and $32$ are \ul{not} primes. 
However, we have the guarantee that $21$ and $32$ are relatively prime, that is, $\gcd(21,32)=1$. 
Also, note that the number $671 = 21\cdot32-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 Extra-Credit}
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. $$

    {\bfseries Solution.}

    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
     
     
\end{enumerate}
\newpage


\end{document}
