1
a) Pr[2] = Pr[a] * Pr[K2] + Pr[b] * Pr[K1] + Pr[c] * Pr[K3] = 1/2 * 1/6 + 1/3 * 2/3 + 1/6 * 1/6 = 1/3
b) Pr[3] = Pr[a] * Pr[K3] + Pr[b] * Pr[K2] + Pr[c] * Pr[K1] = 1/2 * 1/6 + 1/3 * 1/6 + 1/6 * 2/3 = 1/4
c) Pr[b|3] = Pr[b] * Pr[K2] / Pr[3] = 1/3 * 1/6 / 1/4 = 2/9;
d) Pr[c|2] = Pr[c] * Pr[K3] / Pr[2] = 1/6 * 1/6 / 1/3 = 1/12;
e) H[K] = -(Pr[k1] * log2Pr[k1] + Pr[k2] * log2Pr[k2] + Pr[k3] * log2Pr[k3]) = -(2/3 * log22/3 + 1/6 * log21/6 + 1/6 * log21/6) = log23 - 1/3 = 1.2516
2
- Take the first character
A
, the key is 10, so we calculateA + 10 mod 26
and gotK
, and useA
as the new key - Take the second character
U
, the key isA
which equals to0
, so we calculateU + 0 mod 26 = U
and useU
as the new key - Repeat this process, we have
KUNHYOCAKXWLV
as result
3
Given the formula e1(π(M)), we shall permutate the string with π = (2 3 1 4) first and then use the vigenere cipher with key USETHISKEY
on the result.
- Permutation
- Take the first 4 characters
STRE
- Put the 2nd char to 1st, 3rd char to 2nd, 1st char to 3rd and 4th char to 4th
- We get
TRSE
- Repeat this process we have
TRSEMCAIHEPR
as result
- Take the first 4 characters
- Vigenere cipher
- The length of key is 10, so we take the first 10 characters of previous result
TRSEMCAIHE
- Add the character of the key to the corresponding position of the result, for example, for the 1st position, we calculate
T + U mod 26
and getN
, then for the 2nd position, we calculateR + S mod 26
and getJ
- Repeat this process on the 10 taken characters, we have
NJWXTKSSLC
- Repeat the whole process above on the previous result string, we got
NJWXTKSSLCJJ
as final result
- The length of key is 10, so we take the first 10 characters of previous result
4
a) Degree is m = 5
b) Period is 2m - 1= 25 - 1= 31
c) First 5 bit is 11010
d)
- The formula given can be converted into zi = zi - 5 + zi - 4 mod 2
- We have initial stream 11010
- When we calculate the 6th number, we take the sum of 1st and 2nd number, mod 2, and get 0
- Repeat this process, we have result 110100111010011