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

\usepackage{fancyhdr}   
\pagestyle{fancy}      
\lhead{CS 355, Spring 2021}               
\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 6}

\date{}

\maketitle 

\thispagestyle{fancy}  
\pagestyle{fancy}      


\begin{enumerate}

\item {\bfseries RSA Assumption (5+12+5).} Consider RSA encryption scheme with parameters $N=35=5\times 7$.
\begin{enumerate}
    \item Find $\varphi(N)$ and $\mathbb{Z}^{*}_N$. 
    \newline
    %\newpage
    \vspace{0.3 \textheight}
    \item Use repeated squaring and complete the rows $X,X^2, X^4$ for all $X\in \mathbb{Z}^{*}_N$ as you have seen in the class (slides), that is, fill in the following table by adding as many columns as needed.

  {\bfseries Solution.}  \newline
   \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
       \begin{center}
 %      \centering
       \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|}
       \hline
        $X$ &&&&&&&&&&&& \\
       \hline
        $X^2$ &&&&&&&&&&&&\\
       \hline
        $X^4$ &&&&&&&&&&&&\\
        \hline
       \end{tabular}
    \end{center}
      \begin{center}
 %      \centering
       \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|}
       \hline
        $X$ &&&&&&&&&&&& \\
       \hline
        $X^2$ &&&&&&&&&&&&\\
       \hline
        $X^4$ &&&&&&&&&&&&\\
        \hline
       \end{tabular}
    \end{center}
   \vspace{0.2 \textheight}
    \item Find the row $X^5$ and show that $X^5$ is a bijection from $\mathbb{Z}^{*}_N$ to $\mathbb{Z}^{*}_N$.
     \newline
  {\bfseries Solution.}  \newline
   \   %%%
   \begin{center}
 %      \centering
       \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|}
       \hline
        $X$ &&&&&&&&&&&& \\
       \hline
        $X^4$ &&&&&&&&&&&&\\
        \hline
        $X^5$ &&&&&&&&&&&&\\
       \hline
        
       \end{tabular}
    \end{center}
      \begin{center}
 %      \centering
       \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|}
       \hline
        $X$ &&&&&&&&&&&& \\
       \hline
        $X^4$ &&&&&&&&&&&&\\
        \hline
        $X^5$ &&&&&&&&&&&&\\
       \hline        
       \end{tabular}
    \end{center}
    
     \newpage
\end{enumerate}
   

\item {\bfseries Answer to the following questions (7+7+7+7):}
\begin{enumerate}
    \item Compute the three least significant (decimal) digits of $87341011^{324562002}$ by hand.\newline 
    {\bfseries Solution.}  \newline

    \vspace {0.4\textheight}
    \item Is the following RSA signature scheme valid?(Justify your answer)\newline
    $(r||m)=342454323, \sigma=13245345356, N=155, e=664$\newline
    Here, $m$ denotes the message, and $r$ denotes the randomness used to sign $m$ and $\sigma$ denotes the signature. Moreover, $(r||m)$ denotes the concatenation of $r$ and $m$. The signature algorithm $Sign(m)$ returns $(r||m)^d \mod{N}$ where $d$ is the inverse of $e$ modulo $\varphi(N)$. The verification algorithm $Ver(m,\sigma)$ returns ($(r||m)==\sigma^e \mod{N}$). 
    \newline
    {\bfseries Solution.}  \newline
 
    \newpage
    \item 
    Remember that in RSA encryption and signature schemes, $N=p\times q$ where $p$ and $q$ are two large primes. Show that in a RSA scheme (with public parameters $N$ and $e$), if you know $N$ and $\varphi(N)$, then you can find the factorization of $N$ i.e. you can find $p$ and $q$.
    \newline
   {\bfseries Solution.}  \newline

    \vspace {0.3\textheight}
    \item Consider an encryption scheme where 
    $Enc(m):=m^e \mod{N}$ where $e$ is a positive integer relatively prime to $\varphi(N)$ and $Dec(c):=c^d \mod{N}$ where $d$ is the inverse of $e$ modulo $\varphi(N)$.
    Show that in this encryption scheme, if you know the encryption of $m_1$ and the encryption of $m_2$, then you can find 
    the encryption of $(m_1\times m_2)^5$.
    \newline 
   {\bfseries Solution.}  \newline
\end{enumerate}
    \newpage

\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PLEASE LIST COLLABORATORS BELOW  %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
{\bfseries Collaborators :} \newline 
% ENTER THEIR NAMES HERE  

\end{document}

