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

\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 3}

\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 Illustrative Execution of Shamir's Secret Sharing Scheme (0 points).} 
	      We shall work over the field $(\bbZ_7,+,\times)$. 
	      We are interested in sharing a secret among 6 parties so that any 3 parties can reconstruct the secret, but no subset of 2 parties gain additional information about the secret. 
	            
	      Suppose the secret is $s=1$. 
	      The random polynomial of degree $<3$ chosen during the secret sharing steps is $p(X) = 5X^2+ 3X + 1$.
	          
	          
	      \begin{enumerate}
	      	\item {\bfseries (0 points)} What are the respective secret shares of parties 1, 2, 3, 4, 5, and 6? 
	      	              
	      	      {\bfseries Solution.}
	      	      
	      	      $$p(1) = 2, p(2)= 6, p(3)=6, p(4)=2, p(5)=1, p(6)=3$$
	      	          
	      	              
	      	      \newpage
	      	              
	      	\item {\bfseries (0 points)} Suppose parties 2, 3, and 5 are interested in reconstructing the secret. 
	      	      Run the Lagrange Interpolation algorithm as explained in the class. 
	      	              
	      	      ({\footnotesize {\em Remark:} 
	      	      	It is essential to show the step-wise reconstruction procedure to score full points. 
	      	      	In particular, you need to write down the polynomials $p_2(X)$, $p_3(X)$, and $p_5(X)$.
	      	      }) 
	      	          
	      	      {\bfseries Solution.} 
	      	          
	      	      $$p_2(X)+p_3(X)+p_5(X) = 5X^2+3X+1$$
	      	               
	      	      \newpage
	      	              
	      	\item {\bfseries (0 points)} Suppose parties 2, and 3 get together. 
	      	      Let $q_{\widetilde s}(X)$ be the polynomial that is consistent with their shares and the point $(0,\widetilde s)$, for each $\widetilde s\in \bbZ_7$. 
	      	      Write down the polynomials $q_0(X)$, $q_1(X)$, $\dotsc$, $q_6(X)$.
	      	              
	      	      {\bfseries Solution.}
	      	          
	      	      \begin{align*}
	      	      	q_0(X) & = 6X^2 + 5X     \\
	      	      	q_1(X) & = 5X^2 + 3X + 1 \\
	      	      	q_2(X) & = 4X^2 + X + 2  \\
	      	      	q_3(X) & = 3X^2 + 6X + 3 \\
	      	      	q_4(X) & = 2X^2 + 4X + 4 \\
	      	      	q_5(X) & = 1X^2 + 2X + 5 \\
	      	      	q_6(X) & = 6             
	      	      \end{align*}   
	      \end{enumerate}     
	      \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 Security of encryption schemes (8+8 points).}
	      For each encryption scheme below, state whether the scheme is secure or not. Justify your answer in each case. 
	      Note that for a scheme to be secure, it must be both \ul{correct} and \ul{private}. 
	      \begin{enumerate}
	      	\item {\bfseries (8 points)} The message space is $\cM = \{0,1, \dotsc, 8\}$.
	      	      Algorithm $\gen$ chooses a uniform key from the key space $\cK = \{2, 4, 6, 8, 10, 12, 14, 16, 18\}$. The encryption algorithm $\enc_{sk}(m)$ returns $(sk+m) \mod 9$, and the decryption algorithm $\dec_{sk}(c)$ returns $(c-sk) \mod 9$.

	      	      {\bfseries Solution.}

	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	      \newpage

	      	\item {\bfseries (8 points)} The message space is $\cM = \{0,1, \dotsc, 8\}$.
	      	      Algorithm $\gen$ chooses a uniform key from the key space $\cK = \{3, 6, 9, 12, 15, 18, 21, 24, 27\}$. The encryption algorithm $\enc_{sk}(m)$ returns $(sk+m) \mod 9$, and the decryption algorithm $\dec_{sk}(c)$ returns $(c-sk) \mod 9$.

	      	      {\bfseries Solution.}

	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	      \newpage

	      \end{enumerate}
	      
	      \newpage
	      
	      
	      
	      
	      
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%% PROBLEM 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      
	\item\label{q:equiv-def} {\bfseries Equivalent definition of Perfect Secrecy (10 points).}
	      In the lecture, we defined the perfect security for any private-key encryption scheme $(\pred{Gen},\pred{Enc},\pred{Dec})$ as follows. 
	      For any message $m$, cipher-text $c$, and a priori probability distribution $\M$ over the set of messages, we have: 
	      $$ \Pr[\M=m \vert \C=c] = \Pr[\M=m]$$
	      Show that the above definition is \ul{equivalent} to the following alternative definition.  
	      For all messages $m,m'$, cipher-text $c$, and a priori probability distribution $\M$ over the set of messages, we have: 
	      $$ \Pr[\C=c \vert \M=m] = \Pr[\C = c \vert \M=m'].$$
	      
	      {\footnotesize Remarks: 
	      	\begin{enumerate}
	      		\item Proving equivalence means that you have to show that the first definition implies the second definition. 
	      		      And the second definition also implies the first definition.
	      		          
	      		\item Additionally, in this problem, for simplicity, assume that in the probability expressions, no ``division by zero'' error occurs.
	      		\item The distribution of the message is not necessarily uniform.
	      	\end{enumerate}}
	      
	      {\bfseries Solution.}  
	      
	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	         
	         
	      \newpage
	      
	      
	      
	      
	      
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%% PROBLEM 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\item {\bfseries Defining Perfect Security from Ciphertexts (10 points).} 
	      An upstart in the field of cryptography has proposed a new definition for perfect security of private-key encryption schemes. 
	      According to this new definition, a private-key encryption scheme $(\pred{Gen},\pred{Enc},\pred{Dec})$ is perfectly secure if, for all a priori distribution $\M$ over the message space, and any two cipher-texts $c$ and $c'$, we have the following identity. 
	      $$\Pr[\C=c] = \Pr[\C=c']$$
	      Show that the definition in the class does \ul{not} imply this new definition.  
	      
	      {\footnotesize Remarks: 
	      	\begin{enumerate}
	      		\item You need to construct a private-key encryption scheme that is secure according to the definition we learned in class. 
	      		      However, this scheme does not satisfy the new definition.
	      		          
	      		\item Your scheme should be deterministic, and should use the entire message space and ciphertext space. 
	      		      For example, adding a dummy ciphertext to the ciphertext space and saying that that ciphertext appears with a probability of $0$ will not be considered a valid solution. 
	      		      Other inferior solutions, such as a randomized scheme, may not receive full marks. 
	      	\end{enumerate}}
	        
	      {\bfseries Solution.}   
	          
	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      
	      
	      \newpage
	      
	      
	      
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%% PROBLEM 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      
	\item {\bfseries Lagrange Interpolation (3+3+4 points).} 
	      We want to derive a part of the Chinese Remainder Theorem using principles of Lagrange Interpolation. Our goal is the following 
	      \begin{boxedalgo}
	      	Suppose $p$ and $q$ are two distinct primes. Suppose $a\in \{0,\ldots,p-1\}$ and $b\in \{0,\ldots,q-1 \}$. We want to find a natural number $x$ such that 
	      	\begin{align*}
	      		x \pmod p =a\ \text{and}\ x\pmod q=b 
	      	\end{align*}
	      \end{boxedalgo}
	      We shall proceed towards this objective incrementally (similar to the approach of Lagrange interpolation). 
	      \begin{enumerate}
	      	\item {\bfseries (3 points)} Find a natural number $x_p$ satisfying $x_p \pmod p = 1$, and $x_p \pmod q =0$. 
	      	          
	      	      {\bfseries Solution.}
	      	      
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	      \newpage
	      	          
	      	\item {\bfseries (3 points)} Find a natural number $x_q$ satisfying $x_q \pmod p = 0$ and $x_q \pmod q =1$. 
	      	          
	      	      {\bfseries Solution.}  
	      	      
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	          
	      	      \newpage
	      	          
	      	\item {\bfseries (4 points)} Find a natural number $x$ satisfying $x \pmod p = a$ and $x \pmod q =b$. 
	      	          
	      	      {\bfseries Solution.}  
	      	          
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	          
	      \end{enumerate}
	      \newpage
	           
	      
	           
	      
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%% PROBLEM 5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
	      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
	\item {\bfseries A Bit of Counting (8+8+9 points).} 
	      In this problem, we will do some counting related to polynomials that pass through a given set of points in the plane. 
	      We already did this counting (slightly informally) in the class. 
	      Writing the solution for this problem shall make the solution's intuition more concrete. 
	        
	      We are working over the field $(\bbZ_p,+,\times)$, where $p$ is a prime number. 
	      Let $\cP_t$ be the set of all polynomials in the indeterminate $X$ with degree $<t$ and coefficients in $\bbZ_p$. 
	      Throughout this problem, assume that $t\leq p$, so that $\bbZ_p$ contains $t$ distinct first coordinates. 
	        
	      \begin{enumerate}
	      \makeatletter\renewcommand{\p@enumii}{}\makeatother
	      	\item\label{q5:unique} {\bfseries (8 points)} Let $(x_1,y_1)$, $(x_2,y_2)$, $\dotsc$, and $(x_t,y_t)$ be $t$ points in the plane $\bbZ_p^2$. 
	      	      We have that $x_i \neq x_j$ for all $i\neq j$; that is, the first coordinates of the points are all distinct. 
	      	          
	      	      Prove that there exists a {\em unique polynomial} in $\cP_t$ that passes through these $t$ points. 
	      	          
	      	      ({\footnotesize
	      	      	Hint: 
	      	      	Use Lagrange Interpolation and Schwartz--Zippel Lemma. 
	      	      })
	      	          
	      	      {\bfseries Solution.}   
	      	          
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	          
	      	      \newpage
	      	          
	      	\item\label{q5:count-one} {\bfseries (8 points)} Let $(x_1,y_1)$, $(x_2,y_2)$, $\dotsc$, and $(x_{t-1},y_{t-1})$ be $(t-1)$ points in the plane $\bbZ_p^2$.
	      	      We have that $x_i \neq x_j$ for all $i\neq j$; that is, the first coordinates of the points are all distinct.
	      	          
	      	      Prove that $p$ polynomials in $\cP_t$ pass through these $(t-1)$ points. 
	      	          
	      	      {\bfseries Solution.} 
	      	      
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	          
	      	      \newpage
	      	        
	      	\item {\bfseries (9 points)} Let  $(x_1,y_1)$, $(x_2,y_2)$, $\dotsc$, and $(x_k,y_k)$ be $k$ points in the plane $\bbZ_p^2$, where $k\leq t$. 
	      	      We have that $x_i \neq x_j$ for all $i\neq j$; that is, the first coordinates of the points are all distinct.
	      	          
	      	      Prove that $p^{t-k}$ polynomials in $\cP_t$ pass through these $k$ points.  
	      	          
	      	      {\bfseries Solution.}  
	      	      
	      	      \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
	      	          
	      	      \newpage
	      \end{enumerate} 
	      \newpage
	           
	      
	      
	      
	      
	      
	      
	      
\end{enumerate}

\end{document}

