CSC327 ยท 2076 ยท 10 marks
Compare the SHA parameters between SHA-1 and SHA-2 families. Decrypt the cipher text DRIJ with the key using the Hill cipher.
Compare the SHA parameters between SHA-1 and SHA-2 families. Decrypt the cipher text DRIJ with the key $$\begin{pmatrix} 7 & 8 \ 11 & 11 \end{pmatrix}$$ using the Hill cipher. [10]
SHA Parameters Comparison & Hill Cipher Decryption
Part 1: SHA Parameters Comparison (SHA-1 vs SHA-2 Family)
| Parameter | SHA-1 | SHA-224 | SHA-256 | SHA-384 | SHA-512 |
|---|---|---|---|---|---|
| Message Digest Size (bits) | 160 | 224 | 256 | 384 | 512 |
| Max Message Size (bits) | $<2^{64}$ | $<2^{64}$ | $<2^{64}$ | $<2^{128}$ | $<2^{128}$ |
| Block Size (bits) | 512 | 512 | 512 | 1024 | 1024 |
| Word Size (bits) | 32 | 32 | 32 | 64 | 64 |
| Number of Rounds | 80 | 64 | 64 | 80 | 80 |
| Collision Security (bits) | 80 | 112 | 128 | 192 | 256 |
Notes:
- SHA-1 produces a single 160-bit digest; SHA-2 is a family of hash functions with variable output sizes.
- SHA-1 is broken against collision attacks (SHAttered, 2017) and is deprecated.
- SHA-2 uses more complex round functions and better resistance to known attacks.
Part 2: Hill Cipher Decryption of "DRIJ"
Key: $K = \begin{pmatrix} 7 & 8 \ 11 & 11 \end{pmatrix}$, decryption uses $P = K^{-1}C \pmod{26}$.
Step 1: Convert ciphertext to numbers (A=0, ..., Z=25)
$$D=3,\ R=17,\ I=8,\ J=9$$
$$C_1=\begin{pmatrix}3\17\end{pmatrix},\quad C_2=\begin{pmatrix}8\9\end{pmatrix}$$
Step 2: Compute $K^{-1} \pmod{26}$
Determinant: $$\det(K)=(7\cdot 11)-(8\cdot 11)=77-88=-11\equiv 15\pmod{26}$$
Inverse of determinant: find $d$ with $15d\equiv 1\pmod{26}$. $$15\times 7=105=4(26)+1\equiv 1\pmod{26}\Rightarrow 15^{-1}\equiv 7$$
Adjugate: $$\text{adj}(K)=\begin{pmatrix}11 & -8\ -11 & 7\end{pmatrix}\equiv\begin{pmatrix}11 & 18\ 15 & 7\end{pmatrix}\pmod{26}$$
Inverse: $$K^{-1}=7\begin{pmatrix}11 & 18\ 15 & 7\end{pmatrix}=\begin{pmatrix}77 & 126\ 105 & 49\end{pmatrix}\equiv\begin{pmatrix}25 & 22\ 1 & 23\end{pmatrix}\pmod{26}$$
Step 3: Decrypt first pair "DR"
$$P_1=\begin{pmatrix}25 & 22\ 1 & 23\end{pmatrix}\begin{pmatrix}3\17\end{pmatrix}\pmod{26}$$
Row 1: $25\cdot3+22\cdot17=75+374=449$; $449\bmod 26 = 449-17(26)=449-442=7$ Row 2: $1\cdot3+23\cdot17=3+391=394$; $394\bmod 26 = 394-15(26)=394-390=4$
$$P_1=\begin{pmatrix}7\4\end{pmatrix}\Rightarrow H,\ E$$
Step 4: Decrypt second pair "IJ"
$$P_2=\begin{pmatrix}25 & 22\ 1 & 23\end{pmatrix}\begin{pmatrix}8\9\end{pmatrix}\pmod{26}$$
Row 1: $25\cdot8+22\cdot9=200+198=398$; $398\bmod 26 = 398-15(26)=398-390=8$ Row 2: $1\cdot8+23\cdot9=8+207=215$; $215\bmod 26 = 215-8(26)=215-208=7$
$$P_2=\begin{pmatrix}8\7\end{pmatrix}\Rightarrow I,\ H$$
Step 5: Assemble plaintext
$$H,E,I,H \Rightarrow \boxed{\textbf{HEIH}}$$
Verification (encrypt HEIH back): $K\begin{pmatrix}7\4\end{pmatrix}=\begin{pmatrix}49+32\77+44\end{pmatrix}=\begin{pmatrix}81\121\end{pmatrix}\equiv\begin{pmatrix}3\17\end{pmatrix}=DR$ โ $K\begin{pmatrix}8\7\end{pmatrix}=\begin{pmatrix}56+56\88+77\end{pmatrix}=\begin{pmatrix}112\165\end{pmatrix}\equiv\begin{pmatrix}8\9\end{pmatrix}=IJ$ โ
Decrypted plaintext: HEIH
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.