1
$\begingroup$

Given the exact same question and answer here: https://crypto.stackexchange.com/a/37212/40935.

How does one derive/figure out (using equation, combination of equations, or "knowledge") the bold marked parts in the following:

How does one know to put 0.5 and 1/(26^2) in the following places:

  • Pr[C=ff | M=dd] x Pr[M=dd] = [1/26 x 0.5 + 1/(26^2) x 0.5] x 0.2
  • Pr[C=ff | M=de] x Pr[M=de] = [0 x 0.5 + 1/(26^2) x 0.5] x 0.8

I expected the conditional part calculations to be:

  • Pr[C=ff | M=dd] = [1/26 x 0.5 + 1/(26) x 0.5]
  • Pr[C=ff | M=de] = [0 x 0.5 + 1/(26) x 0.5]

So I would like an "equation" possibly based on the law of total probability and/or Bayes' Theorem (or something which I do not know about), such that I can see the symbolic manipulation/calculations which leads to the simple substitution of values as described above.

$\endgroup$
  • 1
    $\begingroup$ Bayes theorem was a good guess, but I would suggest thinking more about conditional probability itself (Bayes theorem is just the combination of $P(A|B)$ and $P(B|A)$). $\endgroup$ – tylo Nov 7 '16 at 19:31
  • $\begingroup$ @tylo Mm, I am thinking that the problem is stated as a "conditional probability", hence I need to expand/substitute something into that definition. This substitution is perhaps total probability or the multiplication rule - $P(A \cap B)=P(A)P(B|A)=P(B)P(A|B)$. $\endgroup$ – Henrik Nov 7 '16 at 21:27
  • $\begingroup$ I suggest not to get hung up too much on the total probability rule. Because it is hardly ever used in any kind of calculations. And what you call multiplication rule is exactly conditional probability. $\endgroup$ – tylo Nov 8 '16 at 9:07
  • $\begingroup$ What you are looking for is this: You don't need $P(C=ff|M=dd)$ etc., you need $P(C=ff|M=dd \cap l=1)$ with $l$ being keylength. Others go analouge. As a rule of thumb: If you don't include $l$ in your formulas, then you basically say that $l$ is independent of whatever you're trying to calculate. For independent events, you have $P(A|B) = P(A)$ (if $P(B)$ is not zero) $\endgroup$ – tylo Nov 8 '16 at 9:13
  • $\begingroup$ @tylo The course I am taking has only mentioned the basic probability laws. Given the numeric answer to the question, I am proposing that $P(A)=\sum\limits_{n} P(A \cap B_{n})=\sum\limits_{n} P(A|B_{n}) P(B_{n})$ is to be used. Because, when using $n=dd$ and $n=de$ in the previous formula you get the parts: $Pr[C=ff | M=dd] \cdot Pr[M=dd]$ and $Pr[C=ff | M=de] \cdot Pr[M=de]$ which are the parts of the correct answer as I see it. Still I do not see how one obtains $Pr[C=ff | M=dd] = [1/26 + 1/26^2]\cdot1/2$, especially 1/26^2...? $\endgroup$ – Henrik Nov 8 '16 at 21:21
1
$\begingroup$

Okay, let's take this one apart piece by piece, with $l$ indicating keylength:

You have:

  • $P(l=1) = P(l=2) = 0.5$
  • $P(m=dd) = 0.8, P(m=de) = 0.2$
  • You want to know $P(c=ff)$
  • Implicitly, we assume that the keys are uniform random (actually not true for Vigenere with actual keywords, but there is no statement in the question).So for any combination of $c,m$, we get a probability of $1/26$ if $l=1$ and $1/26^2$ if $l=2$
  • Implicitly, the key is independent of the message - pretty standard assumption. And of course $l$ is independent as well.

So let's look at the case $l= 1$. Formally we express that as $P(.|l=1)$. This is a conditional probability, because we place the condition $l=1$.

So: $P(c=ff|l=1) = P(c=ff| l = 1 \cap m=de) + P(c=ff | l = 1 \cap m=dd)$
$ = 0 * 1/26 + 1 * 1/26$ (the $0$ indicates "this is not possible", the $1$ indicates "this is possible with exactly $1$ combination")

Analouge: $P(c=ff|l=2) = P(c=ff|l=2 \cap m=de) + P(c=ff|l=2 \cap m=dd)$
$ = 1 * 1/26^2 + 1 * 1/26^2$ (both possible with exactly one combination, so both $1$s)

Now, we want to get $P(c=ff) = P(c=ff|l = 1) \cdot P(l=1) + P(c=ff|l=2) \cdot P(l=2)$
$= (0+1/26) \cdot 0.5 + (1/26^2 + 1/26^2) \cdot 0.5 = 0.5(1/26 + 2/26^2)$
We just use, that the events $l=1$ and $l=2$ are mutually exclusive. And they happen to be the only possibilities we have to consider.

In the end, we get to the same conclusion as your other questions: You missed the condition on $l$ in your first approach. And then in your solution you incorporated it - but missed out on expressing it in the formulas correctly.

$\endgroup$
  • $\begingroup$ Thank you for the detailed description! For me the entire solution hinges on when you say: "So for any combination of c,m, we get a probability of 1/26 if l=1 and 1/26^2 if l=2", because e.g. $P(c=ff|l=2 \cap m=de)$ has to be related to those words which was, (possibly still is), not evident to me, even though it should be. $\endgroup$ – Henrik Nov 10 '16 at 22:18
  • $\begingroup$ @Henrik That probability is $1/26^2$. It is one specific combination of $m,c$ and it already contains the condition $l=2$. $\endgroup$ – tylo Nov 11 '16 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.