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

\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 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_p$. 
        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+10 points).} 
For each encryption scheme below, state whether the scheme is secure or not. Justify your answer in each case. 
\begin{enumerate}
    \item {\bfseries (8 points)} The message space is $\cM = \{0,1, \dotsc, 4\}$. 
    Algorithm $\gen$ chooses a uniform key from the key space $\cK = \{1, 3, 5, 7, 9\}$. The encryption algorithm $\enc_{sk}(m)$ returns $(sk+m) \mod 5$, and the decryption algorithm $\dec_{sk}(m)$ returns $(c-sk) \mod 5$.
    
    {\bfseries Solution.}
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    \newpage
    
    \item {\bfseries (10 points)} The message space $\cM$ is the set of all $n$ bit strings ($\{0,1\}^n$) containing $t$ $1$s. 
    The key space $\cK$ is the set of all permutations of the $n$ positions.
    Algorithm $\gen$ chooses a key uniformly at random from the key space $\cK.$
    The encryption algorithm $\enc_{sk}(m)$ returns $\pi(m)$, and the decryption algorithm $\dec_{sk}(m)$ returns $\pi^{-1}(m)$ where $\pi^{-1} \circ \pi = \mathbb{1}$, $\mathbb{1}$ is the identity permutation.
    
    For example, when $n = 3, t = 2$, let $\cM = \{110, 101, 011\}$ be the set of all $3$ bit strings with two $1$s. 
    Let $m = 101 \in \cM$ be a message.
    Let $\pi: \cM \rightarrow \cM, \pi \in \cK$ be a permutation of the $3$ positions such that $\pi(b_1b_2b_3) = b_2b_3b_1,$ i.e. $\pi(101) = 011.$
    
    {\footnotesize Note:
    This encryption scheme shows that the witness for an encryption does not have to be unique.
    }

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

\newpage





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\item {\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 apriori probability distribution $\M$ over the set of messages, we have: 
$$ \probX{ \M=m \vert \C=c } = \probX{\M=m}$$
Show that the above definition is \underline{equivalent} to the following alternative definition.  
For all messages $m,m'$, cipher-text $c$, and apriori probability distribution $\M$ over the set of messages, we have: 
$$ \probX{\C=c \vert \M=m} = \probX{\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 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 apriori distribution $\M$ over the message space, and any two cipher-texts $c$ and $c'$, we have the following identity. 
$$\probX{\C=c} = \probX{\C=c'}$$
Show that the definition in the class does \ul{not} imply this new definition.  

{\footnotesize Remark. 
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.}
  
    {\bfseries Solution.}   
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE


\newpage



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\item {\bfseries Lagrange Interpolation(5+5+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 (5 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 (5 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$. 
  
\begin{enumerate}
    \item {\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 {\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}
