CryptoHomework1

HomePage | Memberswill go by tor | RecentChanges | Join |

All plus and equal is in the sense of Z 10Z_{10} or Z 10 4Z_{10}^4

Given M 0=(0 0 0 0)M_0 = \begin{pmatrix}0&0&0&0\end{pmatrix} and M 1M_1 and C=(0 0 0 0)C =\begin{pmatrix}0&0&0&0\end{pmatrix} :

C 0=(π(d) π(d) π(d) π(d)) C 1=(π(d) π(d1) π(d3) π(d6)) Left=Pr(C 0=C)= d,πPr(d,π)Pr(C 0=C|d,π) Pr(C 0=C|d,π)={1 π(d)=0 0 else Right=Pr(C 1=C)= d,πPr(d,π)Pr(C 1=C|d,π) Pr(C 1=C|d,π)={1 π(d)=π(d1)=π(d3)=π(d6)=0 0 else\begin{aligned}C_0 = \begin{pmatrix}\pi(d)&\pi(d)&\pi(d)&\pi(d)\end{pmatrix}\\C_1 = \begin{pmatrix}\pi(d)&\pi(d - 1)&\pi(d - 3)&\pi(d - 6)\end{pmatrix}\\Left = Pr(C_0 = C) = \sum_{d,\pi} Pr(d,\pi) Pr(C_0 = C \vert d ,\pi)\\Pr(C_0 = C \vert d,\pi) =\begin{cases}1&\pi(d) = 0\\0&else\end{cases}\\Right = Pr(C_1 = C) = \sum_{d,\pi} Pr(d,\pi) Pr(C_1 = C \vert d,\pi)\\Pr(C_1 = C \vert d,\pi) = \begin{cases}1&\pi(d) = \pi(d - 1)=\pi(d - 3) =\pi(d - 6) = 0\\0&else\end{cases}\end{aligned}

The size of Key set of (d,π)(d, \pi) is 1010!10 \cdot 10!

As uniform selection , the Left is . Right is 0 because it is impossible π(d)=π(d1)=π(d3)=π(d6)=0Pr(d, \pi) = \frac{1}{10 ∙ 10 !\frac{10 ∙ 9 !}{10 ∙ 10 !} = \frac{1}{\pi(d) =\pi(d - 1) =\pi(d - 3) =\pi(d - 6) = 0

So LeftRightLeft \ne Right


Let the mapping from a key to the cipher string with a given MM,

Enc:KEnc(K)={Enc(k)|kK}Enc : K \rightarrow Enc(K) = \{ Enc(k) \vert k \in K \}

Then the probability of a specific cipher text CC is:

Pr(Enc(k)=C|k)={1 Enc(k)=C 0 else Pr(Enc(k)=C)= kKPr(k)Pr(Enc(k)=C|k)\begin{aligned}Pr(Enc(k) = C \vert k) = \begin{cases}1&Enc(k) = C\\0&else\end{cases}\\Pr(Enc(k) = C) = \sum_{k \in K} Pr(k) Pr(Enc(k) = C \vert k)\end{aligned}

If distribution of kk is uniform, then

Pr(Enc(k)=C)= kKPr(k)Pr(Enc(k)=C|k)=1Count(K) kKPr(Enc(k)=C|k)Pr(Enc(k) = C) = \sum_{k \in K} Pr(k) Pr(Enc(k) = C \vert k) = \frac{1}{Count(K)} \sum_{k \in K} Pr(Enc(k) = C \vert k)

The number kKPr(Enc(k)=C|k)\sum_{k \in K} Pr(Enc(k) = C \vert k) may vary dependent on MM; when CC is not in Enc(K)Enc(K), this number is zero; when CC is in Enc(K)Enc(K), the number typically vary with different MM. If this number happens to be the same for any CEnc(K)C \in Enc(K) aka being secrecy, then it follows the distribution of the cipher text is also uniform:

1CountK kKPr(Enc(k)=C|k)=Count(Enc(K))Count(K)\frac{1}{CountK} \sum_{k \in K} Pr(Enc(k) = C \vert k) = \frac{Count(Enc(K))}{Count(K)}

For example of Task 2:

i=1n Count(K)=(2n)! C π 1(i)=M i C π 1(i+n)=M i+n=1M i Pr(Enc(k)=C|k)={1 i=1n,C π 1(i)=M i,C π 1(i+n)=1M i 0 else\begin{aligned}i = 1 \cdots n\\Count(K) = (2 n)!\\C_{\pi^{-1}(i)} = M_i\\C_{\pi^{-1}(i + n)} = M_{i + n}'= 1 - M_i\\Pr(Enc(k) = C \vert k) = \begin{cases}1&i = 1 \cdots n, C_{\pi^{-1}(i)} = M_i, C_{\pi^{-1}(i + n)} = 1 - M_i\\0&else\end{cases} \end{aligned}

To evaluate kKPr(Enc(k)=C|k)\sum_{k \in K} Pr(Enc(k) = C \vert k), consider all the index of 1 in CC being t 1,t 2,,t nt_1,t_2,\cdots,t_n and all the index of 0 in CC being f 1,f 2,,f nf_1,f_2,\cdots,f_n and all the index of 1 in MM' being 1 1,1 2,,1 n1_1,1_2,\cdots,1_n and all the index of 0 in MM' being 0 1,0 2,,0 n0_1,0_2,\cdots,0_n

An example of n=4:

C=(1 0 1 0 0 0 1 1),M=(1 0 0 1 0 1 1 0),(t 1 t 2 t 3 t 4)=(1 3 7 8),(f 1 f 2 f 3 f 4)=(2 4 5 6) (1 1 1 2 1 3 1 4)=(1 4 6 7),(0 1 0 2 0 3 0 4)=(2 3 5 8)\begin{aligned}C=\begin{pmatrix}1\\0\\1\\0\\0\\0\\1\\1\end{pmatrix},M'=\begin{pmatrix}1\\0\\0\\1\\0\\1\\1\\0\end{pmatrix},\begin{pmatrix}t_1&t_2&t_3&t_4\end{pmatrix} = \begin{pmatrix}1&3&7&8\end{pmatrix},\begin{pmatrix}f_1&f_2&f_3&f_4\end{pmatrix} =\begin{pmatrix}2&4&5&6\end{pmatrix}\\\begin{pmatrix}1_1&1_2&1_3&1_4\end{pmatrix} =\begin{pmatrix}1&4&6&7\end{pmatrix},\begin{pmatrix}0_1&0_2&0_3&0_4\end{pmatrix} =\begin{pmatrix}2&3&5&8\end{pmatrix}\end{aligned}

Therefore, the count of π\pi satisfy the constraint of the message MM is n!n!n!n! :

kKPr(Enc(k)=C|k)=n!n!\sum_{k \in K} Pr(Enc(k) = C \vert k) = n ! \cdot n !

And in fact, the count number is irrelevant for any MM:

For any CC in the range:

Pr(Enc(k)=C)=n!n!(2n)!Pr(Enc(k) = C) = \frac{n ! \cdot n !}{(2 n)!}

Note that the size of the range is C n 2nC_n^{2 n} . Being uniform, it means each cipher text is probability of 1C n 2n=n!n!(2n)!\frac{1}{C_n^{2 n}} = \frac{n ! \cdot n !}{(2 n)!}

For any CC not in the range: Pr(Enc(k)=C)=0Pr(Enc(k) = C) = 0