Tribhuwan University

Institute of Science and Technology

2082

Bachelor Level / Third Year / Fifth Semester / Science

B.Sc in Computer Science and Information Technology (CSC327)

(Cryptography)

Full Marks: 60

Pass Marks: 24

Time: 3 Hours

Candidates are required to give their answers in their own words as for as practicable.

The figures in the margin indicate full marks.

Section A

Long Answers Questions

Attempt any TWO questions.
[2*10=20]
1.
Describe the Feistel Cipher structure. Given the key {2B, 7E, 15, 16, 28, AE, D2, A6, AB, F7, 97, 66, 01, 02, 03, 04}, compute the first 4 byte of next key after first iteration, using the following S-Box in AES.
S-Box0123456789ABCDEF0637C777BF26B6FC53001672BFED7AB76\begin{array}{c|cccccccccccccccc} \text{S-Box} & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & A & B & C & D & E & F \\ \hline 0 & 63 & 7C & 77 & 7B & F2 & 6B & 6F & C5 & 30 & 01 & 67 & 2B & FE & D7 & AB & 76 \end{array}
[10]

Feistel Cipher Structure and AES Key Expansion (First 4 Bytes)

Part A: Feistel Cipher Structure

Feistel Cipher is a symmetric block cipher structure that divides the plaintext into two equal halves and processes them through multiple rounds of substitution and permutation, using sub-keys derived from the main key.

Working Principle:

The plaintext block is split into two halves: Left (L) and Right (R). In each round, one half is modified using a round function F and a sub-key, then the halves are swapped.

Structure of Each Round:

For round ii:

Li=Ri1L_i = R_{i-1}

Ri=Li1F(Ri1,Ki)R_i = L_{i-1} \oplus F(R_{i-1}, K_i)

Where KiK_i is the sub-key for round ii and FF is the round function.

Block Diagram (described in words):

  • Plaintext is divided into L₀ (left half) and R₀ (right half)
  • R₀ is passed through function F along with sub-key K₁
  • Output of F is XORed with L₀ to produce R₁
  • R₀ becomes L₁ (swap)
  • This process repeats for n rounds
  • After the final round, the two halves are combined to form ciphertext

Key Properties:

  • Encryption and Decryption use the same structure (sub-keys applied in reverse order for decryption)
  • Round function F need not be invertible
  • Security increases with more rounds
  • Examples: DES (16 rounds), Blowfish, Camellia

Part B: AES Key Expansion — First 4 Bytes of Next Key After First Iteration

Given Key (16 bytes):

W0 W1 W2 W3
2B 7E 15 16 28 AE D2 A6 AB F7 97 66 01 02 03 04

AES Key Expansion Formula:

W4=W0g(W3)W_4 = W_0 \oplus g(W_3)

Where g() function involves:

  • a) RotWord — Circular left shift of W3 by 1 byte
  • b) SubBytes — Substitute each byte using S-Box
  • c) XOR with Rcon — XOR first byte with round constant

Step-by-step Computation:

Step i: Take W3

W3=[01,02,03,04]W_3 = [01, 02, 03, 04]

Step ii: RotWord (circular left shift by 1 byte)

RotWord(01,02,03,04)=[02,03,04,01]RotWord(01, 02, 03, 04) = [02, 03, 04, 01]

Step iii: SubBytes using S-Box

For each byte, the row = upper nibble and column = lower nibble:

  • Byte 02 → Row 0, Col 2 → S-Box value = 77
  • Byte 03 → Row 0, Col 3 → S-Box value = 7B
  • Byte 04 → Row 0, Col 4 → S-Box value = F2
  • Byte 01 → Row 0, Col 1 → S-Box value = 7C

SubBytes=[77,7B,F2,7C]SubBytes = [77, 7B, F2, 7C]

Step iv: XOR with Rcon(1)

Round constant for first round: Rcon(1)=[01,00,00,00]Rcon(1) = [01, 00, 00, 00]

[7701, 7B00, F200, 7C00]=[76,7B,F2,7C][77 \oplus 01, \ 7B \oplus 00, \ F2 \oplus 00, \ 7C \oplus 00] = [76, 7B, F2, 7C]

So, g(W3)=[76,7B,F2,7C]g(W_3) = [76, 7B, F2, 7C]

Step v: Compute W4 = W0 ⊕ g(W3)

W0=[2B,7E,15,16]W_0 = [2B, 7E, 15, 16]

W4=[2B76, 7E7B, 15F2, 167C]W_4 = [2B \oplus 76, \ 7E \oplus 7B, \ 15 \oplus F2, \ 16 \oplus 7C]

W4=[5D,05,E7,6A]W_4 = [5D, 05, E7, 6A]


Final Answer:

The first 4 bytes of the next key after the first iteration are: 5D 05 E7 6A

2.
Illustrate the man in middle attack in Diffie-Hellman key exchange protocol. Assume the prime number be 19 and 10 as its primitive root. Select 5 as private key and 4 as random integer. Find the cipher text of M = 2 using Elgamal crypto system.[10]
3.
Describe the properties of hash functions. Discuss how hash value is generated using SHA-1 algorithm.[10]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
Describe any three types of malicious logic. [5]
5.
Given the key "HELLOWORLD", encrypt the plaintext "TURINGTEST" using Play fair cipher. [5]
6.
Explain any two modes of block cipher encryption. [5]
7.
Describe the working mechanism of digital signature algorithm. [5]
8.
State Fermat's theorem with example. What is the implication of discrete logarithm? [5]
9.
List and explain the types of firewall. [5]
10.
Define authentication system. Discuss about challenge response system. [5]
11.
Decrypt the ciphertext 'HI' using Hill Cipher where the key is.
Ciphertext: HI, Key: [5343]\text{Ciphertext: HI, Key: } \begin{bmatrix} 5 & 3 \\ 4 & 3 \end{bmatrix}
[5]
12.
What is digital certificate? Discuss the certificate life cycle. [5]