0% found this document useful (0 votes)
13 views18 pages

Numerical Practice Questions

Numerical rc4
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views18 pages

Numerical Practice Questions

Numerical rc4
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Practice Question Bank

1. Using the simplified RC4 algorithm with an 8-element state vector (3 bits each, values
0-7): Key K = [2, 5, 3, 1] and Plaintext P = [4, 6, 1, 3]. Perform the Key Scheduling
Algorithm (KSA) to initialize S, execute the Pseudo-Random Generation Algorithm
(PRGA) to produce 4 keystream bytes, and compute the ciphertext C = P XOR Keystream.

2. A wireless Selective Repeat ARQ system has: Window size = 4, Frame transmission
time = 3 ms, Propagation delay = 10 ms (due to satellite link), and one frame lost every
two windows. Determine the RTT and compare efficiency with a terrestrial link where
propagation delay = 1 ms.

3. A GBN protocol operates with: B = 8 Mbps, Tp = 200 ms, L = 4000 bits, Sequence
number bits = 4. Compare GBN with Stop-and-Wait by calculating for each:
(i) Transmission time and parameter a.
(ii) Maximum window size for GBN and efficiency of GBN.
(iii) Stop-and-Wait efficiency and the improvement factor offered by GBN.

4. In a TCP CUBIC connection with initial cwnd = 1 MSS, ssthresh = 18 MSS: slow start
runs RTTs 1-4, congestion avoidance from RTT 5, triple duplicate ACK at RTT 8, timeout
at RTT 11. Compare behavior with TCP Reno by analyzing for RTT 1 to 13:
a. Phase transitions in Slow Start
b. CUBIC vs linear Congestion Avoidance
c. Fast Recovery behavior
d. Impact and recovery from timeout

5. Consider a Stop-and-Wait ARQ protocol with: Frame size = 10000 bytes, Bandwidth =
10 Mbps, One-way propagation delay = 40 ms, ACK frame size is negligible. Calculate:
a. Transmission time of the frame
b. Round Trip Time (RTT)
c. Channel utilization efficiency

6. Analyze a Selective Repeat ARQ scenario with 3-bit sequence numbers, window size =
4. Frames 5, 6, 7, 0 are sent (wrapping around). Frame 6 and frame 0 are lost. Based on
this:
a. List the ACKs generated in sequence by the receiver.
b. State the frames the sender must retransmit.
c. Show the receiver buffer state and the window positions at each step.

7. Analyze a high-speed GBN ARQ system: B = 100 Mbps, Tp = 1 ms, L = 12000 bits,
Sequence number bits = 3. Determine:
(i) Tt in microseconds and compute a.
(ii) Required window for 100% efficiency; compare to GBN's W_max = 2^3 - 1 = 7.
(iii) Efficiency with the available window size and recommended fix (e.g., increase
sequence bits to n = 4 or 5) with recalculated efficiency.
8. For a Selective Repeat ARQ protocol: Window size = 6, Frame size = 500 bytes,
Bandwidth = 2 Mbps, Propagation delay = 4 ms, and one frame error per window.
Determine: (i) Transmission time, (ii) Round trip time, and (iii) Effective throughput
efficiency.

9. Simplified RC4 with 8-element 3-bit state vector: Key K = [2, 6, 1, 4] and Plaintext P =
[7, 3, 5, 2]. Complete the full KSA initialization phase, generate keystream of length 4
using PRGA, compute ciphertext, and identify the final values of i, j pointers after PRGA
generation.

10. Analyze the TCP connection behavior with: Initial cwnd = 1 MSS, ssthresh = 8 MSS.
RTTs 1-3 exhibit slow start, RTT 4 reaches ssthresh, RTT 6 encounters 3 duplicate ACKs,
and RTT 9 results in a timeout. Plot cwnd vs RTT (RTT 1 to 11) and analyze:
a. Slow Start phase transitions
b. Congestion Avoidance linear increase
c. Fast Recovery using TCP Reno mechanism
d. Behavior after timeout and cwnd reset

11. Compare two Stop-and-Wait ARQ scenarios on the same physical link (Bandwidth =
2 Mbps, Propagation delay = 12 ms): Scenario A: Frame size = 500 bytes. Scenario B:
Frame size = 2000 bytes. Calculate efficiency for both and analyze:
a. How frame size impacts transmission time and efficiency
b. Optimal frame size range for this link
c. Which scenario better utilizes the channel

12. Analyze the behavior of a Selective Repeat ARQ system with: Sequence number bits
= 7, Window size = 8. Frames 0 to 12 are transmitted, and frames 1, 2, 5 and 7 are lost
during transmission. Based on this scenario:
a. Identify the sequence of ACKs generated by the receiver.
b. Examine which frames will be retransmitted.
c. Interpret the receiver buffer state.

13. A GBN ARQ system uses: B = 10 Mbps, Tp = 25 ms, L = 1500 bytes, Sequence
number bits = 5. Analyze:
(i) Tt in ms and compute a.
(ii) Window size check: is W_max sufficient for 100% efficiency?
(iii) Channel efficiency η and effective throughput in Mbps.

14. A TCP connection experiences the following: cwnd = 1 MSS, ssthresh = 14 MSS.
Slow start in RTTs 1-3, congestion avoidance RTTs 4-6, triple duplicate ACKs at RTT 7,
congestion avoidance resumes RTTs 8-9, timeout at RTT 10. Graph cwnd from RTT 1 to
12 and analyze:
a. Slow Start exponential growth phase
b. Congestion Avoidance additive phase
c. Transition through Fast Recovery
d. Timeout detection and full CWND reset
15. Encrypt using simplified RC4 (state vector: 8 elements, 3-bit values 0-7): Key K = [4,
3, 7, 2] and Plaintext P = [6, 1, 5, 3]. Show: (i) Initial S array {0,1,2,...,7}, (ii) S array after
complete KSA, (iii) Keystream bytes k1, k2, k3, k4 from PRGA, (iv) Ciphertext C = P XOR
K_stream.

16. Consider a Selective Repeat ARQ system with 3-bit sequence numbers and window
size = 4. Frames 0, 1, 2, 3 are sent. Frame 0 is lost but all others are received. Then the
sender transmits frames 4, 5, 6, 7 of which frame 5 is lost. Examine:
a. ACK patterns for both rounds of transmission.
b. Identification and retransmission of lost frames in each round.
c. Cumulative buffer state and delivery status of all frames.

17. A network uses Go-Back-N ARQ with: Bandwidth = 8 Mbps, Propagation delay = 250
ms, Frame size = 8000 bits, Sequence number field = 5 bits. Calculate:
(i) Transmission time (Tt) and parameter a = Tp/Tt.
(ii) Maximum window size and check if sufficient for 100% efficiency.
(iii) Efficiency (η) and effective throughput with and without sufficient window size.

18. For a TCP connection with initial cwnd = 1 MSS, ssthresh = 10 MSS: The connection
hits ssthresh at RTT 4, three duplicate ACKs are received at RTT 7, ssthresh is updated,
another triple ACK occurs at RTT 10. Draw cwnd vs RTT for RTT 1 to 12 and analyze:
a. Slow Start growth until ssthresh
b. Linear Congestion Avoidance growth
c. First Fast Recovery event and ssthresh update
d. Second Fast Recovery and final cwnd state

19. Stop-and-Wait ARQ operates over a satellite link with: Frame size = 2000 bytes,
Bandwidth = 2 Mbps, One-way propagation delay = 250 ms (geostationary satellite), ACK
negligible. Calculate:
a. Transmission time (Tt)
b. RTT and the 'a' parameter (a = Tp/Tt)
c. Channel efficiency and comment on suitability of S&W for satellite links

20. Analyze the efficiency of a Selective Repeat ARQ system with: Window size = 4,
Frame transmission time = 2 ms, Propagation delay = 7 ms, and frame error rate = 10%
(one lost per 10 frames). Calculate RTT, ideal efficiency (no loss), and actual efficiency
with the given error rate.

21. For a GBN ARQ with: B = 3 Mbps, Tp = 120 ms, L = 1500 bits, n = 3 sequence bits. If
the sequence number is increased from 3 bits to 4 bits (all other parameters unchanged),
analyze:
(i) Tt and a for both cases.
(ii) GBN max window size with 3 bits vs 4 bits.
(iii) Efficiency change and effective throughput improvement with 4-bit sequence
numbers.
22. Analyze a Selective Repeat ARQ network where: Window size = 4, Frame
transmission time = 0.5 ms, Propagation delay = 2 ms, processing time at receiver = 0.2
ms, and one frame is lost per window. Find the RTT including processing time and the
overall efficiency.

23. Apply the simplified RC4 algorithm (8-element, 3-bit state vector, values 0-7): Key K =
[3, 5, 2, 7] and Plaintext P = [4, 1, 6, 0]. Perform all KSA swaps, generate the keystream
using PRGA, and obtain the ciphertext. Compare the initial and final state arrays and
comment on diffusion.

24. TCP Tahoe operates with initial cwnd = 1 MSS, ssthresh = 12 MSS. RTTs 1-4 are in
slow start, congestion avoidance begins at RTT 5, a timeout is detected at RTT 8, and
recovery starts at RTT 9. For RTT 1 to 11, analyze:
a. Exponential cwnd growth during Slow Start
b. Additive increase in Congestion Avoidance
c. Differences in TCP Tahoe vs Reno at packet loss
d. New ssthresh and cwnd values post-timeout

25. For Stop-and-Wait ARQ with: Frame size = 1200 bytes, Bandwidth = 768 Kbps,
Propagation delay = 8 ms, ACK = 20 bytes. Determine:
a. Data frame transmission time
b. ACK transmission time
c. RTT (full round trip including both transmissions)
d. Channel efficiency

26. In a Selective Repeat ARQ with sequence number bits = 4 and window size = 8:
Frames 0 through 7 are transmitted. Frames 3 and 6 are lost. All other frames are
received correctly. Determine:
a. The ACK sequence generated at the receiver side.
b. The frames that must be selectively retransmitted.
c. The receiver buffer state showing held and delivered frames.

27. Analyze a GBN ARQ protocol with: Bandwidth = 1 Mbps, Propagation delay = 50 ms,
Frame size = 500 bits, Sequence number bits = 3, Frame error probability P = 0.01.
Calculate:
(i) Tt, a, and required window size for full efficiency.
(ii) Maximum GBN window size and whether it is adequate.
(iii) GBN efficiency using formula η = W/(1+2a) when W < 1+2a and efficiency with
errors.

28. Trace the cwnd evolution for a TCP connection with cwnd_init = 1 MSS, ssthresh =
24 MSS. RTTs 1-4: slow start, RTT 5 onwards: congestion avoidance, RTT 7: 3 duplicate
ACKs detected (ssthresh = cwnd/2, cwnd = ssthresh + 3), RTT 10: timeout (cwnd = 1,
ssthresh = cwnd/2). Analyze phases for RTT 1 to 12:
a. Slow Start: identify exact cwnd values each RTT
b. Congestion Avoidance: compute cwnd at each step
c. Fast Recovery: new ssthresh and cwnd values
d. Post-timeout behavior and gradual recovery

29. Apply simplified RC4 encryption with 8-element 3-bit state vector: Key K = [5, 1, 6, 3]
and Plaintext P = [2, 4, 0, 7]. Demonstrate the KSA by showing each swap operation, then
generate the keystream using PRGA and compute the ciphertext. List all intermediate S-
array states during KSA.

30. For SR-ARQ with 3 sequence number bits and window size = 4: Frames 0, 1, 2, 3 are
sent. Frames 1 and 2 are both lost. After retransmission of frame 1, frame 2 is
retransmitted. Analyze:
a. Sequence of NAKs or missing ACKs from receiver perspective.
b. Order in which frames 1 and 2 are selectively retransmitted.
c. Final ordered delivery to the upper layer after all retransmissions.

31. A GBN protocol over a wireless link has: B = 1 Mbps, Tp = 5 ms, L = 500 bits, n = 2
sequence bits, Error rate P = 0.05. Calculate:
(i) Tt, a, and W_max for GBN.
(ii) Minimum window size required for 100% efficiency with no errors.
(iii) Actual efficiency given the error rate and maximum window size.

32. In a Selective Repeat ARQ system with: Window size = 7, Frame transmission time =
1.5 ms, Propagation delay = 6 ms, ACK transmission time = 0.1 ms, one frame lost per
window. Calculate: (i) Total RTT including ACK, (ii) Efficiency with loss, (iii) Efficiency
without loss.

33. A Stop-and-Wait ARQ link has: Frame size = 500 bytes, Bandwidth = 512 Kbps, One-
way propagation delay = 20 ms, ACK negligible. Determine:
a. Frame transmission time
b. Round trip time
c. Link efficiency and whether the protocol wastes significant bandwidth

34. In SR-ARQ with 4-bit sequence numbers and window size = 8: Frames 0-7 are sent,
frames 2, 4, and 7 are lost. Analyze:
a. The complete ACK sequence for all 8 transmissions.
b. The order and timing of retransmissions for lost frames.
c. Final receiver buffer state once all frames are correctly received.

35. For a Go-Back-N link: Bandwidth = 5 Mbps, One-way propagation delay = 80 ms,
Frame size = 2000 bits, Sequence bits = 3 bits, P (error rate) = 0.02. Determine:
(i) Tt and a values.
(ii) Required window for 100% efficiency; compare with GBN maximum window.
(iii) Effective throughput with the given error rate using the formula: η = W(1-P) /
((1+2a)(1-P+WP)).
36. Analyze the behavior of a TCP connection with the following parameters: Initial cwnd
= 2 MSS, ssthresh = 12 MSS. RTT 1-5 show normal growth, RTT 6 reaches the threshold,
RTT 7 experiences 3 duplicate ACKs, and RTT 12 results in a timeout. Using a cwnd vs
RTT graph (RTT 1 to 15), analyze the phases of
a. Slow Start
b. Congestion Avoidance
c. Fast Recovery and
d. Timeout event

37. A Stop-and-Wait ARQ system uses: Frame size = 1000 bytes, Bandwidth = 1 Mbps,
Propagation delay = 10 ms. If the bandwidth is increased to 10 Mbps with all other
parameters unchanged, compute:
a. Efficiency at 1 Mbps
b. Efficiency at 10 Mbps
c. Effect of increased bandwidth on S&W efficiency and practical implications

38. A Selective Repeat ARQ system uses 3-bit sequence numbers (sequences 0-7) and a
window size of 4. Frames 0, 1, 2, 3 are sent; frame 2 is lost and frame 4 is successfully
received. Analyze:
a. ACKs sent by the receiver after each frame arrives.
b. Which frames are buffered and which are delivered to the network layer.
c. Identify the retransmitted frame and the updated window state.

39. Apply the simplified RC4 cipher with state vector size = 8 (3-bit values 0-7): Key K =
[3, 1, 4, 2] and Plaintext P = [5, 2, 7, 0]. Show all steps of the KSA initialization, the PRGA
keystream generation, and the final XOR operation to derive ciphertext. Verify by
showing the XOR table.

40. In a Selective Repeat ARQ system: Window size = 8, Frame transmission time = 4 ms,
Propagation delay = 5 ms, and three frames lost per window. Analyze the round trip time
and efficiency of the system.

41. Analyze Stop-and-Wait ARQ with: Frame size = 1500 bytes, Bandwidth = 10 Mbps,
One-way propagation delay = 5 ms, ACK size = 40 bytes. Calculate:
a. Transmission time for data frame
b. Transmission time for ACK
c. Total RTT including ACK transmission
d. Efficiency considering ACK overhead

42. A SR-ARQ system with 3-bit sequence numbers and window size = 4 transmits
frames 0, 1, 2, 3. All frames are received correctly but ACK for frame 1 is lost. Examine:
a. How the receiver handles the received frames despite ACK loss.
b. What happens when the sender's timer for frame 1 expires.
c. The buffer state and whether any frames are duplicated.
43. For a Go-Back-N ARQ system: Bandwidth = 2 Mbps, Propagation delay = 100 ms,
Frame size = 1000 bits, Sequence number bits = 4. Determine:
(i) Transmission time and the ratio a = Tp/Tt.
(ii) Maximum window size (W_max = 2^n - 1) and required window size for 100%
efficiency.
(iii) GBN efficiency when window size is sufficient vs. insufficient.

44. Examine a TCP connection with cwnd = 1 MSS, ssthresh = 64 MSS. The connection
undergoes slow start for RTTs 1-6, enters congestion avoidance at RTT 7, and
experiences a timeout at RTT 10. No fast recovery events occur. Plot cwnd vs RTT (1 to
12) and examine:
a. How cwnd evolves during extended Slow Start
b. Congestion Avoidance phase and cwnd values
c. Effect of timeout on ssthresh calculation
d. Recovery time and steps to reach previous cwnd

45. Using simplified RC4 (8-element state vector, 3-bit values): Key K = [1, 7, 2, 4] and
Plaintext P = [3, 5, 6, 1]. Perform KSA and PRGA steps, compute C = P XOR Keystream.
Then decrypt the ciphertext to verify you recover the original plaintext.

46. For a Selective Repeat ARQ with: Window size = 4, Frame transmission time = 1 ms,
Propagation delay = 3 ms. If the window size is doubled to 8 while all other parameters
remain the same, analyze: (i) RTT before and after change, (ii) Efficiency before and after
change, (iii) Whether the new window size achieves 100% efficiency.

47. Compare GBN performance for two different propagation delays on the same link: B
= 2 Mbps, L = 1000 bits, Sequence bits = 4. Case A: Tp = 10 ms. Case B: Tp = 100 ms. For
each case, compute:
(i) Tt and a parameter.
(ii) Required window vs GBN maximum window.
(iii) Efficiency and comment on the effect of propagation delay on GBN performance.

48. A Selective Repeat ARQ link uses: Window size = 16, Bandwidth = 10 Mbps, Frame
size = 1000 bytes, Propagation delay = 8 ms, ACK size negligible, and one in every 16
frames is lost. Compute the transmission time, round trip time, and channel efficiency.

49. Apply the simplified RC4 stream cipher algorithm (state vector size = 8 elements of 4
bits each) to encrypt the given plaintext. The state vector S contains values from 0 to 7.
The key is K = [0,1,4,7] and the plaintext is P = [1,3,5,7], where each element is 3 bits.
Compute the resulting ciphertext.

50. A TCP Reno connection has: Initial cwnd = 1 MSS, ssthresh = 20 MSS. Slow start
runs through RTT 1-5, congestion avoidance from RTT 6-8, triple duplicate ACK at RTT 9,
and timeout event at RTT 12. Trace cwnd vs RTT from RTT 1 to 14 and analyze:
a. Doubling behavior in Slow Start
b. Unit increase per RTT in Congestion Avoidance
c. Half-window Fast Recovery in TCP Reno
d. Full reset mechanism on timeout

51. For a Stop-and-Wait ARQ with: Frame size = 4000 bits, Data rate = 1 Mbps, One-way
propagation delay = 20 ms, ACK negligible. The link experiences occasional noise
causing frame errors. Determine:
a. Transmission time and RTT
b. Efficiency with no errors
c. Efficiency when every 5th frame is retransmitted (error rate = 20%)
d. Effective throughput in Kbps with errors

52. For a Selective Repeat ARQ with 2-bit sequence numbers and window size = 2:
Frames 0, 1, 2, 3 (modulo 4) are sent in two rounds. Frame 1 is lost in the first
transmission, frame 3 is received successfully. Examine:
a. The complete ACK sequence from receiver.
b. The retransmission action for the lost frame.
c. Potential ambiguity issues and why window size must be <= 2^(n-1).

53. Perform simplified RC4 encryption with an 8-element 3-bit state vector: Key K = [7, 2,
5, 1] and Plaintext P = [0, 3, 4, 6]. Show: (i) KSA: all 8 rounds of S initialization and swaps,
(ii) PRGA: generation of each keystream element with i, j pointer updates, (iii) Final
ciphertext via XOR.

54. A TCP sender begins with cwnd = 2 MSS and ssthresh = 32 MSS. RTTs 1-5 follow
slow start, RTT 6 hits threshold, RTT 8 observes 3 duplicate ACKs (Fast Retransmit
triggered), RTT 11 sees a timeout. Construct a cwnd vs RTT table and graph for RTT 1 to
13. Explain:
a. When and why Slow Start ends
b. How Congestion Avoidance increases cwnd
c. ssthresh update after Fast Recovery
d. cwnd and ssthresh values after timeout

55. A Stop-and-Wait ARQ system has: Frame size = 8000 bits, Bandwidth = 4 Mbps, One-
way propagation delay = 15 ms, ACK negligible, Frame error rate = 5%. Compute:
a. Frame transmission time
b. RTT
c. Efficiency without errors
d. Efficiency with 5% frame error rate using the formula: η = (1-P) / (1 + 2a)

56. Analyze a SR-ARQ protocol with sequence number bits = 3 and window size = 4. The
sender transmits frames 3, 4, 5, 6. Frame 4 is received out-of-order (arriving after frame 5
due to reordering, not loss). Frame 6 is lost. Determine:
a. How the receiver differentiates between out-of-order and lost frames.
b. ACKs generated at receiver for each received frame.
c. Retransmission required and receiver buffer contents.
57. Analyze the performance of Stop-and-Wait ARQ over a fiber-optic link: Frame size =
1500 bytes, Bandwidth = 100 Mbps, One-way propagation delay = 2 ms, ACK = 40 bytes.
Calculate:
a. Data transmission time
b. ACK transmission time
c. RTT
d. Overall channel utilization efficiency and comment on the efficiency value obtained

58. A Selective Repeat ARQ system operates with: Window size = 8, Frame transmission
time = 2 ms, Propagation delay = 5 ms, and one frame lost per window. Calculate the
round trip time (RTT) and channel utilization efficiency. Compare efficiency with and
without frame loss.

59. A simplified RC4 system uses an 8-element state vector with 3-bit values: Key K = [6,
2, 1, 5] and Plaintext P = [3, 7, 4, 1]. Perform full KSA, generate 4 pseudo-random
keystream values using PRGA, and compute the ciphertext. Also show the state of the S
array after KSA is complete.

60. Compute the round trip time and efficiency for a Selective Repeat ARQ system:
Window size = 8, Frame size = 2000 bits, Bandwidth = 1 Mbps, One-way propagation
delay = 20 ms, one frame lost per window, ACK size negligible. Show your calculation
steps.
1. DES (Data Encryption Standard)
Q1.
Perform one round of DES on the 64-bit plaintext P = 0x0123456789ABCDEF using the 64-bit
key K = 0x133457799BBCDFF1. Show only the IP step, the splitting into L₀ and R₀, and the
result of XOR with the subkey K₁ = 0x1B02EFFC7072 (after expansion E(R₀)). State the final
L₁ and R₁ (you may leave the S-box substitution as a label).

Q2.
Apply the DES Initial Permutation (IP) to the 64-bit block M = 0xAA55AA55AA55AA55. Write the
64 bits of the original block in binary and rearrange them using the standard IP table. Show the
resulting L₀ and R₀ (32 bits each).

Q3.
Given L₀ = 0xCC00CC00 and R₀ = 0xF0AAF0AA in a DES round, and an expanded R₀ (after
E-box) of E(R₀) = 0x7A15557B55D5, XOR this with round-key K₁ = 0x1B02EFFC7072 and list
the six 6-bit groups. Identify which S-box each group feeds into.

Q4.
In DES key scheduling, the 64-bit key K = 0x0F1571C947D9E859 is reduced to 56 bits via PC-
1. Apply PC-1 (use the standard table) and split the result into C₀ (28 bits) and D₀ (28 bits).
Then generate C₁ and D₁ by applying a left shift of 1. Show all values in hexadecimal.

Q5.
Three DES rounds produce: L₁R₁ → L₂R₂ → L₃R₃ with round keys K₁ = 0x1B02EFFC7072,
K₂ = 0x79AED9DBC9E5, K₃ = 0x55FC8A42CF99 and simplified F-output values F₁ =
0x234AA9BB, F₂ = 0xBC8A100F, F₃ = 0x4A90CD11. Given L₀ = 0xCC00CC00 and R₀ =
0xF0AAF0AA, compute L₃ and R₃ using the round relation Lₙ = Rₙ₋₁ and Rₙ = Lₙ₋₁ ⊕ F ₙ.

2. AES (Advanced Encryption Standard)


Q1.
Perform the AES SubBytes step on the 4×4 state matrix (values in hex):

19 a0 9a e9
3d f4 c6 f8
e3 e2 8d 48
be 2b 2a 08

Substitute each byte using the AES S-box. Show the resulting state matrix after SubBytes.

Q2.
Apply the AES ShiftRows transformation to the following state matrix:

d4 e0 b8 1e
27 bf b4 41
11 98 5d 52
ae f1 e5 30

Shift row 0 by 0, row 1 by 1, row 2 by 2, and row 3 by 3 positions to the left. Write the resulting
matrix.

Q3.
Perform AES AddRoundKey on the state matrix S and round key RK (all values in hex):

S = [04 e0 48 28 / 66 cb f8 06 / 81 19 d3 26 / e5 9a 7a 4c]
RK = [a0 88 23 2a / fa 54 a3 6c / fe 2c 39 76 / 17 b1 39 05]

XOR each corresponding byte and present the resulting state matrix.

Q4.
In AES-128 key expansion, the initial key (in hex) is:

2b 7e 15 16 28 ae d2 a6 ab f7 15 88 09 cf 4f 3c

The 4-word key W[0..3] is directly taken from the key. Compute W[4] using: W[4] = W[0] ⊕
SubWord(RotWord(W[3])) ⊕ Rcon[1], where Rcon[1] = 01 00 00 00. Show each intermediate
step.

Q5.
Perform the AES MixColumns operation on a single column [87, F2, 4D, 97] (hex). Use GF(2⁸)
arithmetic with the MixColumns matrix:

[2 3 1 1]
[1 2 3 1]
[1 1 2 3]
[3 1 1 2]

Compute the first two bytes of the output column, showing xtime() usage where needed.

3. RC4 Stream Cipher


Q1.
Apply simplified RC4 (state vector size = 8 elements, values 0–7, 3 bits each) to encrypt
plaintext P = [3, 5, 1, 6]. The key is K = [2, 5, 3]. Perform the full KSA to initialize S, then
generate 4 keystream bytes using PRGA. XOR with plaintext to get ciphertext.

Q2.
In a simplified RC4 with N = 8 and key K = [4, 2, 7], show the state of array S after the Key
Scheduling Algorithm (KSA) completes all 8 iterations. Trace i, j, and S at each swap step.

Q3.
After RC4 KSA with K = [1, 3, 5] on a state of size 8 (values 0–7), the resulting S = [6, 4, 2, 7, 0,
5, 3, 1]. Using PRGA, generate the first 5 bytes of keystream. Show i, j, and S at each step.

Q4.
Apply simplified RC4 (N = 6, state size = 6, values 0–5) with key K = [3, 1, 4] to encrypt plaintext
P = [2, 5, 0]. Perform KSA first (6 iterations), then PRGA to generate 3 keystream bytes, and
produce the ciphertext.

Q5.
Given RC4 state vector S = [2, 0, 6, 3, 7, 1, 5, 4] (N=8) already after KSA, with i = 0 and j = 0,
run 4 PRGA steps. After step 4, XOR the 4 keystream bytes with plaintext P = [7, 3, 5, 2] to find
ciphertext C.

4. MD5 (Message-Digest Algorithm 5)


Q1.
Show the MD5 message padding process for the 3-byte ASCII message "abc" (binary
01100001 01100010 01100011). Append the '1' bit, then enough '0' bits, and finally the 64-bit
little-endian length field. How many bytes does the padded message occupy? Show the
complete padded block in hexadecimal.

Q2.
MD5 uses four auxiliary functions: F(B,C,D) = (B∧C)∨(¬B∧D), G = (B∧D)∨(C∧¬D), H =
B⊕C⊕D, I = C⊕(B∨¬D). Evaluate all four functions for B = 0x89ABCDEF, C = 0xFEDCBA98, D
= 0x76543210. Express results in hexadecimal.

Q3.
Perform one MD5 round-1 operation. Given A = 0x67452301, B = 0xEFCDAB89, C =
0x98BADCFE, D = 0x10325476, M[0] = 0xD76AA478, T[1] = 0xD76AA478, and left-rotate
amount s = 7. Compute the new A using: A = B + ((A + F(B,C,D) + M[0] + T[1]) <<< s). Show
F(B,C,D) and each arithmetic step.

Q4.
In MD5 Round 2, the G function is G(B,C,D) = (B∧D)∨(C∧¬D). With A = 0x10325476, B =
0x67452301, C = 0xEFCDAB89, D = 0x98BADCFE, M[1] = 0xE8C7B756, T[17] = 0xF61E2562,
s = 5, compute the updated value of A after one G-function step of MD5. Show G(B,C,D)
explicitly.

Q5.
After all four MD5 rounds, the intermediate hash values are: a₀ = 0x67452301, b₀ =
0xEFCDAB89, c₀ = 0x98BADCFE, d₀ = 0x10325476 and the round outputs are: a₁ =
0x12EF4567, b₁ = 0x89ABCDEF, c₁ = 0x23456789, d₁ = 0xABCDEF01. Compute the final
MD5 digest values (a, b, c, d) by adding (mod 2³²) the initial values to the round outputs.

5. RSA (Rivest–Shamir–Adleman)
Q1.
Choose primes p = 11 and q = 13. Compute n = p×q and φ(n) = (p−1)(q−1). Select public key e
= 7. Use the extended Euclidean algorithm to find the private key d such that e×d ≡ 1 (mod
φ(n)). Encrypt the plaintext M = 5 to get ciphertext C, and verify by decrypting C back to M.

Q2.
In RSA, p = 7 and q = 17. Calculate n and φ(n). Given e = 5, find d using extended Euclidean
algorithm. Encrypt plaintext M = 8 using C = Mᵉ mod n. Show all modular exponentiation steps
using repeated squaring.

Q3.
Use RSA with p = 5, q = 11, e = 3. Compute n, φ(n), and d. A ciphertext C = 14 is received.
Decrypt it using M = Cᵈ mod n. Show the computation of Cᵈ mod n step by step using fast
modular exponentiation.

Q4.
Apply extended Euclidean algorithm to find d = e⁻¹ mod φ(n) for the case p = 13, q = 19, e = 7.
Show the full table of quotients, remainders, and back-substitution steps. Verify your answer by
confirming e × d mod φ(n) = 1.

Q5.
RSA parameters: n = 77 (p=7, q=11), e = 13, d = 37. Encrypt the two-character message "HI" by
treating H = 08 and I = 09 as separate numeric blocks. Compute ciphertext for each block. Then
decrypt both ciphertext values to verify recovery of the original message.

6. SHA-1 (Secure Hash Algorithm 1)


Q1.
Show the SHA-1 padding for the 3-byte message "abc" (24 bits). Append the '1' bit, zeros, and
the 64-bit big-endian message length. Express the padded 512-bit block in hexadecimal
(showing the significant parts) and identify the byte count.

Q2.
SHA-1 uses 80 32-bit words W[0..79]. The first 16 are taken directly from the message block.
Compute W[16] through W[19] using: Wₜ = ROTL¹(Wₜ₋₃ ⊕ Wₜ₋₈ ⊕ Wₜ₋₁₄ ⊕ Wₜ₋₁₆) for the
given values (in hex): W[0]–W[15] = 61626380, 00000000, 00000000, 00000000, 00000000,
00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000,
00000000, 00000000, 00000018.

Q3.
Perform two SHA-1 round-1 iterations (t = 0 and t = 1). Initial hash values: H₀=0x67452301,
H₁=0xEFCDAB89, H₂=0x98BADCFE, H₃=0x10325476, H₄=0xC3D2E1F0. K = 0x5A827999.
W[0] = 0x61626380, W[1] = 0x00000000. Round function: f(t,B,C,D) = (B ∧C) ∨(¬B ∧D) for t =
0..19. Show TEMP = (A<<<5) + f + E + Wₜ + K, then update registers.

Q4.
In SHA-1 round 2 (t = 20), the round function is f(B,C,D) = B ⊕C⊕D with K = 0x6ED9EBA1.
Given current registers A = 0x0116FC33, B = 0x67452301, C = 0x7BF36AE2, D =
0x98BADCFE, E = 0x10325476, and W[20] = 0x00000000. Compute TEMP and the new
register values after this round.

Q5.
After all 80 SHA-1 rounds for the "abc" message block, the round output values are: a =
0x0116FC33, b = 0x67452301, c = 0x7BF36AE2, d = 0x98BADCFE, e = 0x10325476. The
initial hash values are H₀=0x67452301, H₁=0xEFCDAB89, H₂=0x98BADCFE,
H₃=0x10325476, H₄=0xC3D2E1F0. Compute the final digest words (H₀'–H₄') by adding (mod
2³²) each initial value to the corresponding round output.

7. Diffie-Hellman Key Exchange


Q1.
Alice and Bob agree on public parameters prime p = 23 and primitive root g = 5. Alice selects
private key a = 6, Bob selects private key b = 15. Compute Alice's public value A = gᵃ mod p,
Bob's public value B = gᵇ mod p, and the shared secret K_A = Bᵃ mod p (Alice's computation)
and K_B = Aᵇ mod p (Bob's computation). Verify K_A = K_B.

Q2.
Using DH parameters p = 29 and g = 2, Alice chooses a = 5 and Bob chooses b = 12. Compute
all public values and the shared secret key. Then show how an eavesdropper who knows p, g,
A, and B would need to solve the discrete logarithm problem to find a or b.

Q3.
In a DH exchange, p = 17, g = 3. Alice's private key is a = 9, Bob's private key is b = 4. Step
through the entire key exchange: compute A, B, and the shared key K. Then suppose Eve
intercepts the exchange and tries to find a by testing all possible values 1 to p−2. Identify at
what trial Eve finds a.

Q4.
DH parameters: p = 41, g = 6. Alice sends A = 18 to Bob. Bob's private key is b = 7. Compute
Bob's public value B = gᵇ mod p, the shared secret K = Aᵇ mod p (Bob's side), and verify using
K = Bᵃ mod p with Alice's private key a = 28 (such that 6²⁸ mod 41 = 18).

Q5.
Three parties—Alice, Bob, and Carol—perform a three-way Diffie-Hellman key exchange with
public parameters p = 23, g = 5. Their private keys are a = 4, b = 3, c = 7. Describe the two
rounds needed to establish a common shared secret. Compute all intermediate values (gᵃ, gᵇ,
gᶜ, gᵃᵇ, gᵃᶜ, gᵇᶜ mod p) and the final shared key gᵃᵇᶜ mod p.

8. RC5 Block Cipher


Q1.
Apply simplified RC5 with w = 8 bits, r = 2 rounds, b = 1 byte key (u = 1), to encrypt the 2-byte
plaintext P = (0x14, 0xF9). Key K = [0xAA]. Magic constants P₈ = 0xB7, Q₈ = 0x9E. Perform
key expansion to generate subkeys S[0..2r+1] = S[0..5], then apply the 2-round RC5 encryption.
Show each step.

Q2.
In RC5 (w=8, r=1), the subkeys are S[0]=0x3C, S[1]=0xFA, S[2]=0x5B, S[3]=0x27. Plaintext A =
0x1A, B = 0x37. Perform the key whitening step (A = A + S[0], B = B + S[1]) and then one full
round using: A = ((A⊕B) <<< B) + S[2], B = ((B⊕A) <<< A) + S[3]. Show all intermediate values.

Q3.
RC5 (w=16, r=2) decryption: Given ciphertext A = 0x7A3F, B = 0xC12E and subkeys
S[0]=0x11A2, S[1]=0xB4C8, S[2]=0x37D1, S[3]=0x9E4F, S[4]=0x0CB3, S[5]=0xF27A. Reverse
the 2-round encryption using: for i = r down to 1: B = ((B−S[2i+1]) >>> A) ⊕ A, A = ((A−S[2i])
>>> B) ⊕ B; then A = A − S[0], B = B − S[1]. Show all steps.

Q4.
Perform RC5 key expansion for w = 8, r = 3, b = 2 bytes, key K = [0x12, 0x34]. First expand S to
2(r+1) = 8 words using P₈ = 0xB7 and Q₈ = 0x9E: S[0] = P₈, S[i] = (S[i−1] + Q₈) mod 2⁸. Then
run the key mixing loop for 3 × max(8, 2) = 24 iterations. Show the final S[0..7] values.

Q5.
Using RC5 (w=8, r=2) with pre-computed subkeys S[0]=0xA2, S[1]=0x3C, S[2]=0x7F,
S[3]=0xD1, S[4]=0x4B, S[5]=0x88, encrypt the block (A=0x02, B=0x09). Perform: initial
whitening, then Round 1 and Round 2 using RC5 operations. Report the ciphertext (A, B) at the
end.

You might also like