Apologies if this should be in the Mathematics stack exchange, I just ask it here because the context is cryptography. Here is the question that I seemingly cannot get correct:
Consider the Vigenere cipher over the lowercase English alphabet, where the key can have length 1 or length 2, each with 50% probability. Say the distribution over plaintexts is Pr[M='dd'] = 0.2 and Pr[M='de'] = 0.8. What is Pr[C='ff']?
My starting assumptions are therefore that:
Pr[M=dd] = 0.2
Pr[M=de] = 0.8
I believe I can calculate Pr[C=ff] in the following manner:
Pr[C=ff] = (Pr[C=ff | M=dd] x Pr[M=dd]) + (Pr[C=ff | M=de] x Pr[M=de])
From a notation point of view:
M = message
C = ciphertext
K = key
Pr[M=dd] = Probability that the message is 'dd'
Pr[C=ff | M=dd] = Probability the ciphertext is 'ff' conditioned on the message being 'dd'.
The convention for key notation is that:
K=a means 'shift by 0'
K=ab means 'shift first character by 0, shift second character by 1'
etc.
So:
- For key length 1, M=dd: There is only one key that can produce C=ff (that is K=c).
- For key length 2, M=dd: There is only one key that can produce C=ff (that is K=cc)
- For key length 1, M=de: There is no key that can produce C=ff.
- For key length 2, M=de: There is only one key that can produce C=ff (that is K=cb)
Therefore:
- Pr[C=ff | M=dd] x Pr[M=dd] = [1/26 + 1/(26^2)] x 0.2
- Pr[C=ff | M=de] x Pr[M=de] = [0 + 1/(26^2)] x 0.8
Ergo:
- Pr[C=ff] = [1/26 + 1/(26^2)] x 0.2 + [0 + 1/(26^2)] x 0.8
- Pr[C=ff] = 0.009171598
Apparently this is incorrect, but I'm not sure where I'm going wrong, can anyone help explain what I'm doing incorrectly?