Evaluating conditional probability for a cipher text given a plain text message

388 Views Asked by At

I'm not posting this on Cryptography as I have not even understood the math for this, and this had nothing to do with the cryptographic definition inside. Caesar cipher should give enough context, if required.

The cipher works as follows: There is a set of messages $M$ that are strings over the English alphabets $\{a, b, ... z\}$, and a set of keys $K = \{0, 1, ... 25\}$. To encrypt a message, we pick a key k uniformly at random and shift each letter in the word k times. If $'o'$ is the letter and $3$ is the key then it becomes $'r'$ upon encryption. The set of cipher texts is $C$.

Assume the following messages and their distribution. $\textbf{M} = \{"one", "ten"\}$ and $P[M="one"] = 0.5, P[M="ten"] = 0.5$. Key space is $\textbf{K} = \{0, 1, 2 ... 25\}$ as usual. With each key occurring with equal probability $1/26$. Random variables $M\ and\ K$ are independent.

We are required to find the probability that the cipher text is $"rqh"$.

My reasoning is that, the two messages form a partition of the message space and hence, the law of total probability applies.

\begin{align*} P[C="rqh"] &= P[C="rqh" and\ M="one"] + P[C="rqh" and\ M="ten"] (due\ to\ law\ of\ total\ probability)\\ &= P[C="rqh" | M = "one"] * P[M = "one"] + P[C="rqh" | M = "ten"] * P[M = "ten"] (by\ definition\ of\ conditional\ probability)\\ &= {1/26} * 0.5 + 0 * 0.5 (how\ did\ this\ happen\ ?!) = 1/52 \end{align*}

$P[C="rqh" | M = "one"]$ is taken as equal to the probability that, the particular key that caused the shift, was chosen ($k = 3$ produces the desired shift here). How did these two quantities equate ? The first one involves two random variables $M\ and\ C$ while the second appears to be obtained from the probability that the third random variable $K$ took on $3$. Please help me understand this relation.

After this, we prove that the apriori probability of $M$ being $"ten"$ and the aposteriori probability of it being $"ten"$ are not the same hence there is no perfect secrecy. I can understand this part.

Please explain how $P[C="rqh" | M = "one"] = 1/26$ was obtained.

Sorry for the terrible typesetting, I'm still learning to use LaTeX. If some one can fix the equations, I can learn from your edit.

Example taken from: perfects secrecy part ii by Prof. Katz via Coursera.