Hill cipher:
Vigenère cipher:
One reasonable idea for enhancing the security of a cryptosystem is to use double encryption. Is double encryption with the Hill cipher any safer than simple encryption? Justify your answer.
Encrypt the message LJUBLJANA using the Vigenère cipher with the key FRI. Compute the index of coincidence of the obtained ciphertext.
1 2
01234567890123456789012345
ABCDEFGHIJKLMNOPQRSTUVWXYZ
L | J | U | B | L | J | A | N | A |
---|---|---|---|---|---|---|---|---|
11 | 9 | 20 | 1 | 11 | 9 | 0 | 13 | 0 |
F | R | I | F | R | I | F | R | I |
5 | 17 | 8 | 5 | 17 | 8 | 5 | 17 | 8 |
16 | 0 | 2 | 6 | 2 | 17 | 5 | 4 | 8 |
Q | A | C | G | C | R | F | E | I |
Computation of the index of coincidence
The following ciphertext has been encrypted with the Vigenère cipher. Find the possible key lengths with the Kasiski test. Word divisions have not been preserved.
1 2 3 4
01234 56789 01234 56789 01234 56789 01234 56789 012
NKASF BBYIY PWZCW TBIYK PFKUF KBJIA NKABY IYPWZ JMJ
Repetitions:
NKA
: 0, 30, offset: 30BYIYPWZ
: 6, 33, offset: 27Key length candidates: divisors of $\gcd(30, 27) = 3$
$a, b \in \mathbb{Z}_p$, $n$ digits long (in an $\alpha$-based system), $n \approx \log_\alpha(a)$
Calculate $3^6 \bmod{17}$ using the square-and-multiply algorithm.
bit | square | multiply |
---|---|---|
1 | $3^0 = 1$ | $3^1 = 3$ |
1 | $3^2 = 9$ | $3^3 = 27 = 10$ |
0 | $3^6 = 100 = 15$ | $3^6 = 15$ |