Skip to main content

Chapter 1

Cryptography

TU BSc CSIT past exam questions

Past questions and answers

72 questions set from this chapter. Most repeated first.

  • 2076 · 10 marks

Among monoalphabetic and polyalphabetic cipher, which one is more vulnerable? Justify your statement. Which types of keys are considered weak keys in DES? Explain the round operation in IDEA.

Answer

Monoalphabetic vs polyalphabetic cipher

A monoalphabetic cipher (Caesar, general substitution) maps each plaintext letter to one fixed ciphertext letter throughout the message. A polyalphabetic cipher (Vigenere, Vernam) uses several substitution alphabets chosen by the key, so the same plaintext letter can become different ciphertext letters.

The monoalphabetic cipher is more vulnerable. Justification:

  • It preserves the letter frequency distribution of the language. In English, E, T, A, O are the most common; the most frequent ciphertext letter is probably E, the next T, and so on. Frequency analysis, together with digraph/trigraph patterns (TH, HE, THE), breaks it quickly.
  • The key space of a simple Caesar cipher is only 25, and even the general substitution (26! keys) falls to frequency analysis.
  • In a polyalphabetic cipher the frequencies are flattened, because one plaintext letter is spread over several ciphertext letters. It can still be attacked (Kasiski test, index of coincidence) but only after finding the key length, so it is much harder.

Weak keys in DES

DES derives 16 subkeys from the 56-bit key. A key is weak if all 16 subkeys are identical. Then encryption equals decryption: EK(EK(m))=mE_K(E_K(m)) = m. There are 4 weak keys (in hex, with parity bits):

  • 0101010101010101
  • FEFEFEFEFEFEFEFE
  • E0E0E0E0F1F1F1F1
  • 1F1F1F1F0E0E0E0E

They arise when the two 28-bit halves C0C_0, D0D_0 are all 0s or all 1s, so the rotations never change them. Semi-weak keys (12 keys, 6 pairs) are also avoided: they generate only two distinct subkeys, and one key of a pair decrypts what the other encrypts, EK1(EK2(m))=mE_{K_1}(E_{K_2}(m)) = m.

Round operation in IDEA

IDEA works on 64-bit blocks with a 128-bit key and has 8 identical rounds plus an output transformation. The block is split into four 16-bit sub-blocks X1,X2,X3,X4X_1, X_2, X_3, X_4. Each round uses six 16-bit subkeys K1…K6K_1 \dots K_6 and three incompatible operations: XOR (⊕\oplus), addition mod 2162^{16} (⊞\boxplus), and multiplication mod 216+12^{16}+1 (⊙\odot).

  1. A=X1⊙K1A = X_1 \odot K_1
  2. B=X2⊞K2B = X_2 \boxplus K_2
  3. C=X3⊞K3C = X_3 \boxplus K_3
  4. D=X4⊙K4D = X_4 \odot K_4
  5. E=A⊕CE = A \oplus C
  6. F=B⊕DF = B \oplus D
  7. G=(F⊞(E⊙K5))⊙K6G = (F \boxplus (E \odot K_5)) \odot K_6
  8. H=(E⊙K5)⊞GH = (E \odot K_5) \boxplus G
  9. Output of the round: (A⊕G,  C⊕G,  B⊕H,  D⊕H)(A \oplus G,\; C \oplus G,\; B \oplus H,\; D \oplus H). The two middle blocks are swapped before the next round (not after the last round).

Steps 5 to 8 form the multiplication-addition (MA) structure. After round 8 the output transformation uses four more subkeys: Y1=X1⊙K1Y_1 = X_1 \odot K_1, Y2=X2⊞K2Y_2 = X_2 \boxplus K_2, Y3=X3⊞K3Y_3 = X_3 \boxplus K_3, Y4=X4⊙K4Y_4 = X_4 \odot K_4. In total 8×6+4=528 \times 6 + 4 = 52 subkeys are used. They come from the 128-bit key: the first 8 subkeys are the key split into 16-bit pieces, then the key is rotated left by 25 bits and split again, and so on.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 10 marks

State Fermat’s theorem with an example. Given the prime number p=29 and its primitive root g=8, private key sender with X=9 and random integer K=11, encrypt the message m=13 using ElGamal cryptosystem.

Answer

Fermat's little theorem

If pp is prime and aa is an integer not divisible by pp, then ap−1≡1(modp)a^{p-1} \equiv 1 \pmod p Equivalently ap≡a(modp)a^p \equiv a \pmod p for every integer aa.

Example: p=7p = 7, a=3a = 3: 36=729=104×7+13^6 = 729 = 104 \times 7 + 1, so 36≡1(mod7)3^6 \equiv 1 \pmod 7.

ElGamal encryption

Given p=29p = 29, g=8g = 8, private key X=9X = 9, random K=11K = 11, message m=13m = 13.

Public key: Y=gX mod p=89 mod 29Y = g^X \bmod p = 8^9 \bmod 29.

82=64≡68^2 = 64 \equiv 6, 84≡36≡78^4 \equiv 36 \equiv 7, 88≡49≡208^8 \equiv 49 \equiv 20, so 89≡20×8=160≡160−145=158^9 \equiv 20 \times 8 = 160 \equiv 160 - 145 = 15.

Y=15Y = 15

Ciphertext pair (C1,C2)(C_1, C_2):

C1=gK mod p=811 mod 29C_1 = g^K \bmod p = 8^{11} \bmod 29 811=88⋅82⋅8≡20×6×8=960≡960−957=38^{11} = 8^8 \cdot 8^2 \cdot 8 \equiv 20 \times 6 \times 8 = 960 \equiv 960 - 957 = 3. So C1=3C_1 = 3.

C2=m⋅YK mod p=13×1511 mod 29C_2 = m \cdot Y^K \bmod p = 13 \times 15^{11} \bmod 29 152=225≡2215^2 = 225 \equiv 22, 154≡484≡2015^4 \equiv 484 \equiv 20, 158≡400≡2315^8 \equiv 400 \equiv 23, so 1511=158⋅152⋅15≡23×22×1515^{11} = 15^8 \cdot 15^2 \cdot 15 \equiv 23 \times 22 \times 15. 23×22=506≡506−493=1323 \times 22 = 506 \equiv 506 - 493 = 13; 13×15=195≡195−174=2113 \times 15 = 195 \equiv 195 - 174 = 21. So YK=21Y^K = 21.

C2=13×21=273≡273−261=12C_2 = 13 \times 21 = 273 \equiv 273 - 261 = 12.

Ciphertext = (3, 12).

Check by decryption: Ks=C1X=39=19683≡21(mod29)K_s = C_1^X = 3^9 = 19683 \equiv 21 \pmod{29} (same as YKY^K). 21−1 mod 29=1821^{-1} \bmod 29 = 18 since 21×18=378=13×29+121 \times 18 = 378 = 13 \times 29 + 1. m=12×18=216≡216−203=13m = 12 \times 18 = 216 \equiv 216 - 203 = 13. Correct.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 10 marks

Compare the SHA parameters between SHA-1 and SHA-2 families. Decrypt the cipher text DRJI with the key (\begin{pmatrix}7 & 8\ 11 & 11\end{pmatrix}) using the Hill cipher.

Answer

Comparison of SHA-1 and SHA-2 parameters

ParameterSHA-1SHA-224SHA-256SHA-384SHA-512
Message digest size (bits)160224256384512
Message size limit (bits)<264< 2^{64}<264< 2^{64}<264< 2^{64}<2128< 2^{128}<2128< 2^{128}
Block size (bits)51251251210241024
Word size (bits)3232326464
Number of steps8064648080
Security (collision, bits)below 63 (broken)112128192256

SHA-1 is considered broken for collision resistance, so SHA-2 is preferred. SHA-2 has a larger digest, a more complex message schedule and round function.

Hill cipher decryption of DRJI

Key K=(781111)K = \begin{pmatrix}7 & 8\\ 11 & 11\end{pmatrix}.

det⁡K=7⋅11−8⋅11=−11≡15(mod26)\det K = 7 \cdot 11 - 8 \cdot 11 = -11 \equiv 15 \pmod{26}. Since gcd⁡(15,26)=1\gcd(15, 26) = 1 the key is invertible. 15−1 mod 26=715^{-1} \bmod 26 = 7 because 15×7=105=4×26+115 \times 7 = 105 = 4 \times 26 + 1.

K−1=7(11−8−117)=(77−56−7749)≡(2522123)(mod26)K^{-1} = 7 \begin{pmatrix}11 & -8\\ -11 & 7\end{pmatrix} = \begin{pmatrix}77 & -56\\ -77 & 49\end{pmatrix} \equiv \begin{pmatrix}25 & 22\\ 1 & 23\end{pmatrix} \pmod{26}

Check: first row of KK times first column of K−1K^{-1}: 7⋅25+8⋅1=183=7×26+1≡17 \cdot 25 + 8 \cdot 1 = 183 = 7 \times 26 + 1 \equiv 1. Correct.

Ciphertext pairs: DR = (3, 17), JI = (9, 8).

P=K−1CP = K^{-1} C (column vectors):

  • DR: 25⋅3+22⋅17=75+374=449≡449−442=725 \cdot 3 + 22 \cdot 17 = 75 + 374 = 449 \equiv 449 - 442 = 7 (H); 1⋅3+23⋅17=394≡394−390=41 \cdot 3 + 23 \cdot 17 = 394 \equiv 394 - 390 = 4 (E).
  • JI: 25⋅9+22⋅8=225+176=401≡401−390=1125 \cdot 9 + 22 \cdot 8 = 225 + 176 = 401 \equiv 401 - 390 = 11 (L); 1⋅9+23⋅8=193≡193−182=111 \cdot 9 + 23 \cdot 8 = 193 \equiv 193 - 182 = 11 (L).

Plaintext = HELL

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 5 marks

Define discrete logarithm. Explain the procedure of sharing the secret key in Diffie Hellman.

Answer

Discrete logarithm

Let pp be prime and gg a primitive root of pp. For any yy with 1≤y≤p−11 \le y \le p-1 there is a unique exponent xx (0≤x≤p−20 \le x \le p-2) such that y≡gx(modp)y \equiv g^x \pmod p The exponent xx is the discrete logarithm of yy to base gg modulo pp, written x=dlogg,p(y)x = \mathrm{dlog}_{g,p}(y). Computing yy from xx is easy (fast modular exponentiation), but finding xx from yy is computationally hard for large pp. This one-way property secures Diffie-Hellman, ElGamal and DSA.

Diffie-Hellman key exchange

Public parameters: a large prime pp and a primitive root gg of pp.

  1. Alice picks a secret XA<pX_A < p and computes the public value YA=gXA mod pY_A = g^{X_A} \bmod p.
  2. Bob picks a secret XB<pX_B < p and computes YB=gXB mod pY_B = g^{X_B} \bmod p.
  3. They exchange YAY_A and YBY_B over the open channel.
  4. Alice computes K=YBXA mod pK = Y_B^{X_A} \bmod p; Bob computes K=YAXB mod pK = Y_A^{X_B} \bmod p.

Both get the same key since YBXA=gXBXA=gXAXB=YAXB(modp)Y_B^{X_A} = g^{X_B X_A} = g^{X_A X_B} = Y_A^{X_B} \pmod p.

Example: p=23p = 23, g=5g = 5, XA=6X_A = 6, XB=15X_B = 15. YA=56 mod 23=8Y_A = 5^6 \bmod 23 = 8, YB=515 mod 23=19Y_B = 5^{15} \bmod 23 = 19. K=196 mod 23=2K = 19^6 \bmod 23 = 2 and 815 mod 23=28^{15} \bmod 23 = 2.

An eavesdropper sees p,g,YA,YBp, g, Y_A, Y_B but would need a discrete logarithm to get XAX_A or XBX_B. The basic protocol does not authenticate the parties, so it is open to a man-in-the-middle attack.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 5 marks

Distinguish between stream cipher and block cipher. Encrypt the message WE ARE IN SAME RACE UNTILL OVER LIVE END using Rail fence cipher using 4 as a number of rails.

Answer

Stream cipher vs block cipher

Stream cipherBlock cipher
Encrypts one bit or byte at a timeEncrypts a fixed-size block (64 or 128 bits) at a time
Key stream is XORed with plaintextPlaintext block is passed through substitution and permutation rounds
Fast, small hardware, low delaySlower, more complex
Suited to real-time data (voice, wireless)Suited to files, stored data and bulk encryption
Key stream must never be reusedModes (CBC, CTR) are needed to handle long messages
Examples: RC4, A5/1, ChaChaExamples: DES, AES, IDEA

Rail fence encryption (4 rails)

Plaintext without spaces: WEAREINSAMERACEUNTILLOVERLIVEEND (32 letters).

Writing the letters in a zigzag over 4 rails:

  • Rail 1: W N A I R N (positions 1, 7, 13, 19, 25, 31)
  • Rail 2: E I S R C T L E L E D
  • Rail 3: A E A E E N L V I E
  • Rail 4: R M U O V

Reading the rails one after another:

WNAIRN + EISRCTLELED + AEAEENLVIE + RMUOV

Ciphertext = WNAIRNEISRCTLELEDAEAEENLVIERMUOV

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 5 marks

Define digital signature. Describe the approaches of DSS.

Answer

Digital signature

A digital signature is a value computed from a message and the signer's private key which lets anyone check, with the signer's public key, that the message came from the signer and was not changed. It gives authentication, integrity and non-repudiation.

Approaches of the Digital Signature Standard (DSS)

DSS (FIPS 186) uses the SHA hash with a public-key signature algorithm. It specifies two approaches.

  1. RSA approach. The message is hashed with SHA to a fixed-length digest. The digest is encrypted (signed) with the sender's private RSA key. The receiver recomputes the hash of the received message, decrypts the signature with the sender's public key, and compares the two. A match means the signature is valid. This follows the generic hash-then-sign model.

  2. DSA approach (Digital Signature Algorithm). DSA is based on the discrete logarithm problem (ElGamal and Schnorr ideas) and can only sign, not encrypt. Global parameters are a prime pp, a prime divisor qq of p−1p-1, and g=h(p−1)/q mod pg = h^{(p-1)/q} \bmod p. The private key is x<qx < q and the public key is y=gx mod py = g^x \bmod p.

    • Signing: pick a random k<qk < q; compute r=(gk mod p) mod qr = (g^k \bmod p) \bmod q and s=k−1(H(M)+xr) mod qs = k^{-1}(H(M) + xr) \bmod q. The signature is (r,s)(r, s).
    • Verifying: compute w=s−1 mod qw = s^{-1} \bmod q, u1=H(M) w mod qu_1 = H(M)\,w \bmod q, u2=r w mod qu_2 = r\,w \bmod q, v=(gu1yu2 mod p) mod qv = (g^{u_1} y^{u_2} \bmod p) \bmod q. The signature is valid if v=rv = r.

In DSA the hash and a fresh random kk are fed into the signing function, so the same message gives different signatures each time. kk must never be reused or revealed.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 5 marks

What is the task of a firewall? List the elements of X.509.

Answer

Task of a firewall

A firewall is a system placed between a trusted internal network and an untrusted external network (the Internet). It forces all traffic in both directions to pass through it, and only traffic allowed by the local security policy is passed. Its tasks are:

  • Filter packets by IP address, port and protocol (access control).
  • Block unauthorized access and hide internal network structure (NAT).
  • Log and audit traffic, and raise alarms for suspicious activity.
  • Provide a single point for enforcing security policy and for VPN or proxy services.

A firewall itself should be immune to penetration. It cannot protect against attacks that bypass it (dial-up modems, infected laptops) or against insiders.

Elements of an X.509 certificate

  • Version
  • Certificate serial number
  • Signature algorithm identifier (algorithm and parameters used to sign)
  • Issuer name (the certification authority)
  • Validity period (not before, not after)
  • Subject name (the owner of the public key)
  • Subject public key information (algorithm, parameters, key)
  • Issuer unique identifier (optional, version 2)
  • Subject unique identifier (optional, version 2)
  • Extensions (version 3)
  • Signature (the CA's digital signature over all the above fields)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 5 marks

How does the nature of worms differ from viruses? Define PKI with its architecture model.

Answer

Worms vs viruses

VirusWorm
Needs a host program or file to attach toStandalone program that needs no host
Spreads only when the infected file is run or shared by a userSpreads by itself over networks, exploiting vulnerabilities, e-mail, shares
Mainly damages or corrupts files on the infected machineMainly consumes bandwidth and resources, creates backdoors, and can carry a payload
Replicates by inserting its code into other filesReplicates by copying itself to other machines
Example: Jerusalem, CIHExample: Morris worm, Code Red, Slammer

Public Key Infrastructure (PKI)

PKI is the set of hardware, software, people, policies and procedures needed to create, manage, distribute, use, store and revoke digital certificates, so that public keys can be bound to identities and trusted.

PKI architecture model

  • End entities (subscribers): users, servers or devices that hold certificates and use them.
  • Registration Authority (RA): verifies the identity of the applicant and forwards the request to the CA.
  • Certification Authority (CA): issues, signs and revokes X.509 certificates. CAs form a hierarchy with a trusted root CA at the top and subordinate CAs below, each certified by its parent.
  • Repository (directory, such as LDAP): stores certificates and Certificate Revocation Lists (CRLs) so that they can be retrieved.
  • Certificate Revocation List / OCSP: tells relying parties which certificates are no longer valid.
  • Relying party: verifies a certificate by checking the CA signature up the chain to a trusted root, and checks validity and revocation.

Process: the user generates a key pair and sends a request to the RA, the RA verifies identity, the CA issues a signed certificate and publishes it in the repository, and others use it to verify signatures or encrypt data for the user.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 5 marks

Explain the procedure of mix column transformation in AES with an example.

Answer

MixColumns transformation in AES

MixColumns operates on each of the four columns of the state independently. Each column is treated as a vector of four bytes and is multiplied by a fixed matrix, with arithmetic in GF(28)GF(2^8) using the irreducible polynomial x8+x4+x3+x+1x^8 + x^4 + x^3 + x + 1 (hex 11B):

(s0′s1′s2′s3′)=(02030101010203010101020303010102)(s0s1s2s3)\begin{pmatrix} s'_0\\ s'_1\\ s'_2\\ s'_3 \end{pmatrix} = \begin{pmatrix} 02 & 03 & 01 & 01\\ 01 & 02 & 03 & 01\\ 01 & 01 & 02 & 03\\ 03 & 01 & 01 & 02 \end{pmatrix} \begin{pmatrix} s_0\\ s_1\\ s_2\\ s_3 \end{pmatrix}

Addition is XOR. Multiplication by 01 leaves the byte unchanged. Multiplication by 02 is a left shift by one bit, followed by XOR with 1B if the top bit of the original byte was 1. Multiplication by 03 is (02⋅a)⊕a(02 \cdot a) \oplus a. MixColumns gives diffusion: each output byte depends on all four input bytes of its column. It is omitted in the last round.

Example. Column (DB,13,53,45)(DB, 13, 53, 45).

  • 02⋅DB02 \cdot DB: DB=1101 1011DB = 1101\,1011, top bit is 1, shift gives 1011 0110=B61011\,0110 = B6, XOR 1B gives ADAD. 03⋅DB=AD⊕DB=7603 \cdot DB = AD \oplus DB = 76.
  • 02⋅13=2602 \cdot 13 = 26, 03⋅13=26⊕13=3503 \cdot 13 = 26 \oplus 13 = 35.
  • 02⋅53=A602 \cdot 53 = A6, 03⋅53=A6⊕53=F503 \cdot 53 = A6 \oplus 53 = F5.
  • 02⋅45=8A02 \cdot 45 = 8A, 03⋅45=8A⊕45=CF03 \cdot 45 = 8A \oplus 45 = CF.

First output byte: s0′=02⋅DB⊕03⋅13⊕53⊕45=AD⊕35⊕53⊕45=8Es'_0 = 02 \cdot DB \oplus 03 \cdot 13 \oplus 53 \oplus 45 = AD \oplus 35 \oplus 53 \oplus 45 = 8E.

Likewise s1′=DB⊕02⋅13⊕03⋅53⊕45=4Ds'_1 = DB \oplus 02\cdot13 \oplus 03\cdot53 \oplus 45 = 4D, s2′=DB⊕13⊕02⋅53⊕03⋅45=A1s'_2 = DB \oplus 13 \oplus 02\cdot53 \oplus 03\cdot45 = A1, s3′=03⋅DB⊕13⊕53⊕02⋅45=BCs'_3 = 03\cdot DB \oplus 13 \oplus 53 \oplus 02\cdot45 = BC.

Output column: (8E,4D,A1,BC)(8E, 4D, A1, BC).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 5 marks

What is the role of the prime number in the Euler totient Function? Find the GCD of 12 and 16 using the Euclidean algorithm.

Answer

Role of the prime number in Euler's totient function

Euler's totient ϕ(n)\phi(n) is the count of integers in 1…n1 \dots n that are relatively prime to nn.

  • For a prime pp, every number 1…p−11 \dots p-1 is coprime to pp, so ϕ(p)=p−1\phi(p) = p - 1.
  • For n=pqn = pq with distinct primes, ϕ(n)=(p−1)(q−1)\phi(n) = (p-1)(q-1).
  • For a prime power, ϕ(pk)=pk−pk−1\phi(p^k) = p^k - p^{k-1}.

Because of this, ϕ(n)\phi(n) is easy to compute when the prime factors are known and hard when they are not. RSA relies on this: e d≡1(modϕ(n))e\,d \equiv 1 \pmod{\phi(n)} with ϕ(n)=(p−1)(q−1)\phi(n) = (p-1)(q-1), and Euler's theorem aϕ(n)≡1(modn)a^{\phi(n)} \equiv 1 \pmod n makes decryption work. Fermat's theorem is the special case n=pn = p.

GCD(12, 16) by the Euclidean algorithm

16=1×12+416 = 1 \times 12 + 4 12=3×4+012 = 3 \times 4 + 0

The last non-zero remainder is 4.

gcd⁡(12,16)=4\gcd(12, 16) = 4

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 5 marks

Write down any two limitations of MAC. What do policy and mechanism mean in cryptography? Describe with a scenario.

Answer

Two limitations of MAC (message authentication code)

  1. No non-repudiation. The MAC key is shared by sender and receiver, so either could have produced the tag. A third party cannot tell who created the message, which a digital signature can show.
  2. Key distribution and management. Both parties must share a secret key in advance, and for nn users n(n−1)/2n(n-1)/2 keys are required. A compromised key lets an attacker forge messages. (A MAC also gives authentication and integrity but not confidentiality.)

Policy and mechanism

  • A security policy states what is allowed and what is not: it defines the secure and non-secure states of a system. It says "what" is to be protected.
  • A security mechanism is the method, tool or procedure used to enforce the policy, for example encryption, passwords, access control lists, firewalls. It says "how".

Scenario: a university's policy says "only the registered teacher of a course may change the marks of its students, and students may only view their own marks". The mechanisms that enforce this are user login with password or OTP (authentication), an access control list on the marks database (authorization), encryption of the connection with TLS, and audit logs. If a mechanism cannot enforce the policy (for example any logged-in user can edit any marks), the system is not secure with respect to the policy.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2076 · 5 marks

Write short notes on
  1. Classes of Intruder
  2. SSL
  3. DoS Attack

Answer

1. Classes of intruder

Anderson classified intruders into three classes:

  • Masquerader: an outsider (not authorized to use the system) who penetrates access controls and uses a legitimate user's account, for example with a stolen password.
  • Misfeasor: a legitimate user who accesses data, programs or resources they are not authorized for, or who misuses their privileges.
  • Clandestine user: a person (inside or outside) who seizes supervisory control of the system and uses it to evade auditing and access control, or to suppress audit collection.

2. SSL (Secure Sockets Layer)

SSL (now succeeded by TLS) is a protocol that gives secure communication between client and server on top of TCP, widely used with HTTPS. It provides confidentiality (symmetric encryption), message integrity (MAC), and server (optionally client) authentication using X.509 certificates. It has two layers: the Record Protocol (fragmentation, compression, MAC, encryption) and the upper protocols (Handshake, Change Cipher Spec, Alert). The handshake negotiates the cipher suite, authenticates the server, and establishes a shared session key.

3. DoS attack

A Denial of Service attack tries to make a system, service or network unavailable to its legitimate users by exhausting resources such as bandwidth, memory or CPU. Common forms are SYN flooding (half-open TCP connections), ping flood or smurf (ICMP amplification), and UDP flood. In a Distributed DoS (DDoS) the traffic comes from many compromised machines (a botnet), which makes it hard to block. Countermeasures include rate limiting, ingress filtering, SYN cookies, firewalls/IPS and traffic scrubbing services.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 10 marks

Define CIA triad. State the encryption process of double and triple DES. What is the task of S-Box in DES ? Discuss with an example.

Answer

CIA triad

The CIA triad is the three core goals of information security:

  • Confidentiality: information is disclosed only to authorized parties (encryption, access control).
  • Integrity: information and systems are modified only in authorized ways, and changes are detectable (hashes, MACs, digital signatures).
  • Availability: information and services are accessible to authorized users when needed (redundancy, backups, DoS protection).

Double DES

Two DES stages with two independent 56-bit keys K1,K2K_1, K_2: C=EK2(EK1(P)),P=DK1(DK2(C))C = E_{K_2}(E_{K_1}(P)), \qquad P = D_{K_1}(D_{K_2}(C)) The effective key length looks like 112 bits, but the meet-in-the-middle attack (encrypt PP with all K1K_1, decrypt CC with all K2K_2, look for a match) needs only about 2572^{57} operations. So double DES gives about 57 bits of security.

Triple DES (3DES)

Three DES operations in encrypt-decrypt-encrypt (EDE) order with keys K1,K2,K3K_1, K_2, K_3 (or K3=K1K_3 = K_1 for the two-key version): C=EK3(DK2(EK1(P))),P=DK1(EK2(DK3(C)))C = E_{K_3}(D_{K_2}(E_{K_1}(P))), \qquad P = D_{K_1}(E_{K_2}(D_{K_3}(C))) With K1=K2=K3K_1 = K_2 = K_3 it reduces to single DES, giving backward compatibility. The effective strength is 112 bits (168 bits nominal).

S-box in DES

After the expansion permutation, the 48-bit value is XORed with the 48-bit round subkey and split into eight 6-bit groups. Each group enters one of eight S-boxes (S1…S8S_1 \dots S_8), each of which maps 6 bits to 4 bits, giving 32 bits. The S-boxes are the only non-linear step of DES and give confusion.

Method: the outer two bits (first and last) select the row (0 to 3) and the middle four bits select the column (0 to 15).

Example: input 011011011011 to S1S_1. Row bits 0 1→01=10\,1 \to 01 = 1. Column bits 1101=131101 = 13. Row 1 of S1S_1 is 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8; entry 13 is 5. Output =5=0101= 5 = 0101. So the 6-bit input 011011011011 becomes the 4-bit output 01010101.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 10 marks

Explain the generic model of digital signature process. Consider the two prime numbers 7 and 19. Select 29 as public key and 41 as private key. Encrypt the plaintext 4 and decrypt the cipher text 3 using RSA.

Answer

Generic model of the digital signature process

  1. Signing (sender A). The message MM is passed through a hash function to get a fixed-length digest H(M)H(M). The digest is encrypted with A's private key to give the signature S=EPRA(H(M))S = E_{PR_A}(H(M)). A sends MM together with SS (optionally, MM is also encrypted for confidentiality).
  2. Verification (receiver B). B hashes the received message to get H(M′)H(M'). B also decrypts SS with A's public key to recover H(M)H(M). If the two digests are equal, the signature is valid.

Thus B knows that the message came from A (authentication), that it was not altered (integrity), and A cannot deny sending it (non-repudiation). Only A's private key could produce a signature that A's public key verifies.

RSA

p=7p = 7, q=19q = 19, so n=pq=133n = pq = 133 and ϕ(n)=6×18=108\phi(n) = 6 \times 18 = 108. Public key e=29e = 29, private key d=41d = 41. Check: 29×41=1189=11×108+129 \times 41 = 1189 = 11 \times 108 + 1, so ed≡1(mod108)ed \equiv 1 \pmod{108}. Valid.

Encrypt plaintext 4: C=429 mod 133C = 4^{29} \bmod 133.

42=164^2 = 16; 44=256≡256−133=123≡−104^4 = 256 \equiv 256 - 133 = 123 \equiv -10; 48≡1004^8 \equiv 100; 416≡10000 mod 1334^{16} \equiv 10000 \bmod 133: 133×75=9975133 \times 75 = 9975, so 2525.

29=16+8+4+129 = 16 + 8 + 4 + 1: 429≡25×100×(−10)×4(mod133)4^{29} \equiv 25 \times 100 \times (-10) \times 4 \pmod{133}. 25×100=2500≡2500−2394=106≡−2725 \times 100 = 2500 \equiv 2500 - 2394 = 106 \equiv -27. −27×−10=270≡270−266=4-27 \times -10 = 270 \equiv 270 - 266 = 4. 4×4=164 \times 4 = 16.

C=16C = 16

Decrypt ciphertext 3: M=341 mod 133M = 3^{41} \bmod 133.

32=93^2 = 9; 34=813^4 = 81; 38=6561≡6561−6517=443^8 = 6561 \equiv 6561 - 6517 = 44 (133×49=6517133 \times 49 = 6517); 316=1936≡1936−1862=743^{16} = 1936 \equiv 1936 - 1862 = 74; 332=5476≡5476−5453=233^{32} = 5476 \equiv 5476 - 5453 = 23 (133×41=5453133 \times 41 = 5453).

41=32+8+141 = 32 + 8 + 1: 341≡23×44×3=30363^{41} \equiv 23 \times 44 \times 3 = 3036. 133×22=2926133 \times 22 = 2926, 3036−2926=1103036 - 2926 = 110.

M=110M = 110

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 10 marks

Define Galois field with an example. Explain any two modes of block cipher encryption. Deterimine the quadratic residues of 7.

Answer

Galois field

A Galois field GF(n)GF(n) is a finite set of nn elements in which addition, subtraction, multiplication and division (by non-zero elements) are defined and satisfy the field axioms. It exists only when n=pmn = p^m for a prime pp. For m=1m = 1, GF(p)GF(p) is the integers {0,1,…,p−1}\{0, 1, \dots, p-1\} with arithmetic mod pp. For m>1m > 1 the elements are polynomials of degree below mm with coefficients in GF(p)GF(p), with arithmetic mod an irreducible polynomial.

Example: GF(7)={0,…,6}GF(7) = \{0, \dots, 6\}: 5+4=9≡25 + 4 = 9 \equiv 2, 3×5=15≡13 \times 5 = 15 \equiv 1, so 3−1=53^{-1} = 5. AES uses GF(28)GF(2^8) with the irreducible polynomial x8+x4+x3+x+1x^8 + x^4 + x^3 + x + 1.

Two modes of block cipher encryption

  1. Electronic Codebook (ECB). Each plaintext block is encrypted independently with the same key: Ci=EK(Pi)C_i = E_K(P_i). Decryption: Pi=DK(Ci)P_i = D_K(C_i). It is simple and parallelizable, and an error affects only one block. But identical plaintext blocks give identical ciphertext blocks, so patterns leak; it is suitable only for short data such as keys.

  2. Cipher Block Chaining (CBC). Each plaintext block is XORed with the previous ciphertext block before encryption: Ci=EK(Pi⊕Ci−1),C0=IVC_i = E_K(P_i \oplus C_{i-1}), \quad C_0 = IV Pi=DK(Ci)⊕Ci−1P_i = D_K(C_i) \oplus C_{i-1} The IV is random and sent with the message. Identical plaintext blocks give different ciphertext, so patterns are hidden. Encryption is sequential; a bit error in CiC_i garbles PiP_i and flips the same bit in Pi+1P_{i+1}.

Quadratic residues of 7

aa is a quadratic residue mod 7 if x2≡a(mod7)x^2 \equiv a \pmod 7 has a solution with gcd⁡(a,7)=1\gcd(a,7)=1.

xx123456
x2 mod 7x^2 \bmod 7142241

The quadratic residues of 7 are {1,2,4}\{1, 2, 4\}; the non-residues are {3,5,6}\{3, 5, 6\}.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

What does intrusion mean? How the system detect intrusion? List any four types of firewall.

Answer

Intrusion

An intrusion is an unauthorized attempt to access, misuse or damage a system or network, or to violate its security policy. It can be an outsider breaking in, or an insider abusing privileges (masquerader, misfeasor, clandestine user).

How a system detects intrusion

An Intrusion Detection System (IDS) works on the assumption that intruder behaviour differs from legitimate behaviour. Two main approaches:

  1. Statistical anomaly detection: a profile of normal behaviour (login times, commands used, resources consumed) is built for each user. Activity that deviates significantly from the profile is flagged. It can detect new attacks, but may give false positives.
  2. Rule-based (signature / misuse) detection: audit records are compared with a set of known attack signatures or rules (for example, repeated failed logins, known exploit patterns). It is accurate for known attacks but cannot detect new ones.

Detectors can be host-based (HIDS, using audit logs and file changes on one machine) or network-based (NIDS, monitoring traffic). Honeypots are also used to attract and study intruders.

Four types of firewall

  1. Packet-filtering firewall (filters on IP addresses, ports, protocol)
  2. Stateful inspection firewall (tracks connection state)
  3. Application-level gateway (proxy firewall)
  4. Circuit-level gateway

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Decrypt the message “GVPJ” using Hill cipher taking the key as {Row1 = 3 7, Row2 = 5 12}.

Answer

Key K=(37512)K = \begin{pmatrix}3 & 7\\ 5 & 12\end{pmatrix}, ciphertext GVPJ.

det⁡K=3⋅12−7⋅5=36−35=1\det K = 3 \cdot 12 - 7 \cdot 5 = 36 - 35 = 1, and 1−1=11^{-1} = 1, so K−1=(12−7−53)≡(1219213)(mod26)K^{-1} = \begin{pmatrix}12 & -7\\ -5 & 3\end{pmatrix} \equiv \begin{pmatrix}12 & 19\\ 21 & 3\end{pmatrix} \pmod{26}

Check: 3⋅12+7⋅21=36+147=183≡1(mod26)3 \cdot 12 + 7 \cdot 21 = 36 + 147 = 183 \equiv 1 \pmod{26} (since 183=7×26+1183 = 7 \times 26 + 1), and 3⋅19+7⋅3=78≡03 \cdot 19 + 7 \cdot 3 = 78 \equiv 0. Correct.

Ciphertext pairs: GV = (6, 21), PJ = (15, 9).

  • GV: 12⋅6+19⋅21=72+399=471≡471−468=312 \cdot 6 + 19 \cdot 21 = 72 + 399 = 471 \equiv 471 - 468 = 3 (D); 21⋅6+3⋅21=126+63=189≡189−182=721 \cdot 6 + 3 \cdot 21 = 126 + 63 = 189 \equiv 189 - 182 = 7 (H).
  • PJ: 12⋅15+19⋅9=180+171=351≡351−338=1312 \cdot 15 + 19 \cdot 9 = 180 + 171 = 351 \equiv 351 - 338 = 13 (N); 21⋅15+3⋅9=315+27=342≡342−338=421 \cdot 15 + 3 \cdot 9 = 315 + 27 = 342 \equiv 342 - 338 = 4 (E).

Plaintext = DHNE

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Describe the PKI trust model.

Answer

PKI trust model

In a Public Key Infrastructure, a trust model describes how users decide to trust the public key certificate of another party, that is, how certification authorities (CAs) are organized and how trust is passed along a chain of certificates. The main models are:

  1. Hierarchical (rooted) model. A single root CA sits at the top and is trusted by everyone. It issues certificates to subordinate CAs, which in turn certify other CAs or end users. To verify a certificate, a user follows the chain up to the root, checking each signature. This is the model used by the web (X.509). If the root is compromised, the whole tree fails.

  2. Single CA model. One CA issues all certificates; simple but a single point of failure, and not scalable.

  3. Mesh (cross-certification) model. Several independent CAs trust each other by issuing cross-certificates. There is no single root; a user trusts their own CA and reaches others through certificate paths. It is flexible but path building is complex.

  4. Bridge CA model. A bridge CA cross-certifies with the root of each separate hierarchy, so the hierarchies can interoperate without a full mesh.

  5. Web of trust (PGP). There are no CAs. Each user signs the keys of others they know, and trusts a key if it is signed by introducers they trust. Trust is decentralized and personal.

Validation in all models checks the signatures along the path, validity dates, and revocation status (CRL or OCSP).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Define authentication system. Illustrate the need of mutual authentication over one way authentication with an example.

Answer

Authentication system

An authentication system verifies the claimed identity of a user, device or message source before access is granted. Evidence can be something the user knows (password, PIN), has (smart card, token, OTP device) or is (fingerprint, face), and the system combines such factors with an authentication protocol and a store of credentials. The aim is to be sure that "the entity is who it claims to be".

One-way vs mutual authentication

In one-way authentication only one party (usually the client) proves its identity to the other (the server). The client cannot be sure the server is genuine.

In mutual authentication both parties authenticate each other, typically with a challenge-response exchange (nonces) using shared keys or certificates.

Need for mutual authentication, with an example

Consider an internet banking customer who logs in with username and password. With only one-way authentication, an attacker can set up a fake website (phishing, DNS spoofing or a man-in-the-middle). The customer, who has no means of checking the server, enters the password and the attacker captures it, then uses it on the real bank.

With mutual authentication (for example TLS with a server certificate checked by the browser in addition to the user's login, or Kerberos where the client sends an authenticator and the server returns timestamp+1timestamp + 1 encrypted with the session key), the client first verifies that the server holds a valid certificate or the right key, and only then sends credentials. The fake server fails this check, so man-in-the-middle and impersonation of the server are prevented. The same applies to a mobile phone and base station, or two servers talking to each other, where each must trust the other.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Find the value of 7^2019 MOD 13 using Fermat’s Little theorem. Define Euler totient function with
an example.

Answer

72019 mod 137^{2019} \bmod 13 using Fermat's little theorem

Since 13 is prime and gcd⁡(7,13)=1\gcd(7, 13) = 1, Fermat gives 712≡1(mod13)7^{12} \equiv 1 \pmod{13}.

Divide the exponent: 2019=12×168+32019 = 12 \times 168 + 3 (as 12×168=201612 \times 168 = 2016).

72019=(712)168⋅73≡1168⋅73=343(mod13)7^{2019} = (7^{12})^{168} \cdot 7^3 \equiv 1^{168} \cdot 7^3 = 343 \pmod{13}

343=13×26+5343 = 13 \times 26 + 5, so 72019 mod 13=57^{2019} \bmod 13 = 5

Euler totient function

ϕ(n)\phi(n) is the number of positive integers less than nn that are relatively prime to nn (with ϕ(1)=1\phi(1) = 1). For prime pp, ϕ(p)=p−1\phi(p) = p - 1; for primes p≠qp \ne q, ϕ(pq)=(p−1)(q−1)\phi(pq) = (p-1)(q-1); in general ϕ(n)=n∏p∣n(1−1p)\phi(n) = n\prod_{p \mid n}\left(1 - \frac1p\right).

Example: n=10n = 10. The numbers coprime to 10 are 1, 3, 7, 9, so ϕ(10)=4\phi(10) = 4. Check: ϕ(10)=ϕ(2)ϕ(5)=1×4=4\phi(10) = \phi(2)\phi(5) = 1 \times 4 = 4.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

List the properties of hash function. Discuss the first pass of MD4.

Answer

Properties of a hash function

A hash function HH maps a message of any length to a fixed-length digest h=H(M)h = H(M). Required properties:

  1. Applicable to a block of data of any size.
  2. Produces a fixed-length output.
  3. Easy to compute H(M)H(M) for any MM (practical in hardware and software).
  4. Preimage resistance (one-way): given hh, it is computationally infeasible to find MM with H(M)=hH(M) = h.
  5. Second preimage resistance (weak collision resistance): given M1M_1, it is infeasible to find M2≠M1M_2 \ne M_1 with H(M2)=H(M1)H(M_2) = H(M_1).
  6. Collision resistance (strong): it is infeasible to find any pair M1≠M2M_1 \ne M_2 with H(M1)=H(M2)H(M_1) = H(M_2).
  7. Pseudorandom output (avalanche effect: a one-bit change flips about half the output bits).

First pass (round) of MD4

MD4 processes the message in 512-bit blocks split into sixteen 32-bit words X[0..15]X[0..15], and uses a 128-bit state of four registers (A,B,C,D)(A, B, C, D) (initial values 67452301, EFCDAB89, 98BADCFE, 10325476 in hex). Each block goes through three passes of 16 steps each.

In the first pass:

  • The auxiliary function is F(X,Y,Z)=(X∧Y)∨(¬X∧Z)F(X,Y,Z) = (X \wedge Y) \vee (\neg X \wedge Z) (bitwise "if X then Y else Z").
  • No additive constant is used.
  • The words are taken in order k=0,1,…,15k = 0, 1, \dots, 15.
  • Each step is a=(a+F(b,c,d)+X[k])⋘sa = (a + F(b,c,d) + X[k]) \lll s, and the roles of the registers rotate with each step.
  • The left-rotation amounts repeat as s=3,7,11,19s = 3, 7, 11, 19 for each group of four steps.

For example, the first four steps are A=(A+F(B,C,D)+X[0])⋘3A = (A + F(B,C,D) + X[0]) \lll 3 D=(D+F(A,B,C)+X[1])⋘7D = (D + F(A,B,C) + X[1]) \lll 7 C=(C+F(D,A,B)+X[2])⋘11C = (C + F(D,A,B) + X[2]) \lll 11 B=(B+F(C,D,A)+X[3])⋘19B = (B + F(C,D,A) + X[3]) \lll 19 and this pattern is repeated for X[4..7]X[4..7], X[8..11]X[8..11] and X[12..15]X[12..15]. The result of the third pass is added to the input registers to give the chaining value.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Differentiate between Symmetric and Asymmetric cipher. Encrypt the message “HELL” using
the key “FAIL” using Vernanm cipher.

Answer

Symmetric vs asymmetric cipher

SymmetricAsymmetric
One shared secret key for encryption and decryptionA key pair: public key and private key
Key must be exchanged secretly beforehandPublic key can be published; private key never shared
Fast, suitable for bulk dataSlow, computationally heavy, used for small data and key exchange
n(n−1)/2n(n-1)/2 keys for nn users2n2n keys for nn users
No non-repudiationSupports digital signatures and non-repudiation
Examples: DES, AES, IDEAExamples: RSA, ElGamal, ECC

Vernam cipher: HELL with key FAIL

Each letter is encoded A=0, ..., Z=25 and the key letter is added mod 26 (equivalent to XOR in the binary form).

HELL
Plain741111
Key (FAIL)50811
Sum mod 261241922
CipherMETW

Ciphertext = METW

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Divide 3x^2 + 4x +3 by 5x +6 over GF(7).

Answer

Divide f(x)=3x2+4x+3f(x) = 3x^2 + 4x + 3 by g(x)=5x+6g(x) = 5x + 6 over GF(7)GF(7).

In GF(7)GF(7), 5−1=35^{-1} = 3 because 5×3=15≡15 \times 3 = 15 \equiv 1.

Step 1. Leading terms: 3x2÷5x=3⋅3 x=9x≡2x3x^2 \div 5x = 3 \cdot 3\,x = 9x \equiv 2x. 2x⋅(5x+6)=10x2+12x≡3x2+5x2x \cdot (5x + 6) = 10x^2 + 12x \equiv 3x^2 + 5x. Subtract: (3x2+4x+3)−(3x2+5x+0)=−x+3≡6x+3(3x^2 + 4x + 3) - (3x^2 + 5x + 0) = -x + 3 \equiv 6x + 3.

Step 2. 6x÷5x=6⋅3=18≡46x \div 5x = 6 \cdot 3 = 18 \equiv 4. 4⋅(5x+6)=20x+24≡6x+34 \cdot (5x + 6) = 20x + 24 \equiv 6x + 3. Subtract: (6x+3)−(6x+3)=0(6x + 3) - (6x + 3) = 0.

Quotient=2x+4,Remainder=0\text{Quotient} = 2x + 4, \qquad \text{Remainder} = 0

Check: (2x+4)(5x+6)=10x2+12x+20x+24=10x2+32x+24≡3x2+4x+3(mod7)(2x+4)(5x+6) = 10x^2 + 12x + 20x + 24 = 10x^2 + 32x + 24 \equiv 3x^2 + 4x + 3 \pmod 7. Correct.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Define SSL protocol. Mention the services provided by PGP.

Answer

SSL protocol

Secure Sockets Layer (SSL) is a protocol, developed by Netscape and standardised as TLS, that provides secure communication between a client and a server over TCP. It sits between the application layer and TCP and is used by HTTPS, secure mail and other protocols. It provides:

  • Confidentiality, by symmetric encryption of the data with a session key negotiated during the handshake.
  • Message integrity, by a MAC on each record.
  • Authentication of the server (and optionally the client) with X.509 certificates.

It consists of the Record Protocol (fragmentation, compression, MAC, encryption) and the Handshake, Change Cipher Spec and Alert protocols.

Services provided by PGP (Pretty Good Privacy)

  1. Authentication (digital signature): the message hash (SHA) is signed with the sender's private key (RSA/DSS).
  2. Confidentiality: the message is encrypted with a one-time symmetric session key (CAST-128, IDEA, 3DES), and the session key is encrypted with the recipient's public key (RSA/ElGamal).
  3. Compression: the message is compressed (ZIP) after signing and before encryption, saving space and adding redundancy.
  4. E-mail compatibility: binary output is converted to ASCII using radix-64 (Base64) encoding.
  5. Segmentation and reassembly: large messages are split to meet e-mail size limits.
  6. Key management: public key rings and private key rings, and key signing via a web of trust.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 10 marks

Illustrate the concept of security policy and mechanism with an example. Differentiate between block cipher and stream cipher. Explain the process of key expansion in AES.

Answer

Security policy and mechanism

A security policy is a statement of what is and is not allowed in a system; it divides states into authorized (secure) and unauthorized (non-secure). A security mechanism is a method, tool or procedure that enforces the policy. The policy says what to protect and from whom; the mechanism says how.

Example: a hospital's policy says "only the treating doctor may read or change a patient's record; patients may read their own." Mechanisms that enforce it are login with password and OTP (authentication), role-based access control lists on the records database (authorization), encryption of stored and transmitted records, and audit logs. If any logged-in nurse could open every record, the mechanism would not meet the policy.

Block cipher vs stream cipher

Block cipherStream cipher
Processes data in fixed-size blocks (64 or 128 bits)Processes one bit or byte at a time
Uses substitution and permutation rounds; needs padding and a mode of operationKey stream is generated and XORed with plaintext
Same key and plaintext block give same output in ECB; hides patterns in CBC/CTRKey stream must never repeat
Slower, more complexFaster, simple hardware, no padding
Examples: DES, AES, IDEAExamples: RC4, A5/1, ChaCha20

Key expansion in AES

The key expansion routine turns the cipher key into a key schedule of round keys, each 128 bits (four 32-bit words). The number of round keys is Nr+1N_r + 1: 11 for AES-128 (Nr=10N_r = 10), 13 for AES-192, 15 for AES-256. For AES-128, 44 words w0…w43w_0 \dots w_{43} are produced.

  1. The first four words w0…w3w_0 \dots w_3 are the 16 bytes of the cipher key itself (used in the initial AddRoundKey).
  2. For each later word wiw_i (i≥4i \ge 4):
    • If ii is not a multiple of 4: wi=wi−4⊕wi−1w_i = w_{i-4} \oplus w_{i-1}.
    • If ii is a multiple of 4: wi=wi−4⊕g(wi−1)w_i = w_{i-4} \oplus g(w_{i-1}), where gg does three things:
      1. RotWord: cyclic left shift of the word by one byte, [b0,b1,b2,b3]→[b1,b2,b3,b0][b_0, b_1, b_2, b_3] \to [b_1, b_2, b_3, b_0].
      2. SubWord: each of the four bytes is replaced using the AES S-box.
      3. Round constant: the result is XORed with Rcon[i/4]=(RCi/4,00,00,00)Rcon[i/4] = (RC_{i/4}, 00, 00, 00), where RC1=01RC_1 = 01 and RCj=02⋅RCj−1RC_j = 02 \cdot RC_{j-1} in GF(28)GF(2^8) (01, 02, 04, 08, 10, 20, 40, 80, 1B, 36).
  3. For AES-256, an extra SubWord (without rotation or Rcon) is applied to wi−1w_{i-1} when i mod 8=4i \bmod 8 = 4.

Words w4r…w4r+3w_{4r} \dots w_{4r+3} form the round key for round rr. The non-linear S-box and the round constants remove symmetry between rounds and make recovering the cipher key from a round key hard.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 10 marks

Describe the properties of hash functions. Discuss how hash value is generated using SHA-1 algorithm.

Answer

(Properties of hash functions)

A hash function HH maps a message MM of arbitrary length to a fixed-length output h=H(M)h = H(M) called the hash value or message digest. A cryptographic hash function should have:

  1. Variable input size: HH can be applied to a block of data of any size.
  2. Fixed output size: HH produces a fixed-length output (160 bits for SHA-1).
  3. Efficiency: computing H(M)H(M) is easy and fast for any MM, in hardware and software.
  4. Preimage resistance (one-way): for a given hh, it is computationally infeasible to find yy with H(y)=hH(y) = h.
  5. Second preimage resistance (weak collision resistance): for a given xx, it is infeasible to find y≠xy \neq x with H(y)=H(x)H(y) = H(x).
  6. Collision resistance (strong collision resistance): it is infeasible to find any pair (x,y)(x, y), x≠yx \neq y, with H(x)=H(y)H(x) = H(y).
  7. Pseudorandomness: the output satisfies standard randomness tests, and a one-bit change in the input changes about half the output bits (avalanche effect).

(SHA-1 hash generation)

SHA-1 takes a message of length less than 2642^{64} bits and produces a 160-bit digest. It processes the message in 512-bit blocks.

Step 1: Padding. Append a single bit 1, then enough 0 bits so that the length is 448 mod 512448 \bmod 512. Padding is always added, even if the message already has that length.

Step 2: Append length. Append the original message length as a 64-bit big-endian integer. The padded message is now a multiple of 512 bits, split into blocks Y1,…,YLY_1, \dots, Y_L.

Step 3: Initialise the buffer. Five 32-bit registers are set to:

A=67452301,  B=EFCDAB89,  C=98BADCFE,  D=10325476,  E=C3D2E1F0A = \text{67452301},\; B = \text{EFCDAB89},\; C = \text{98BADCFE},\; D = \text{10325476},\; E = \text{C3D2E1F0}

Step 4: Process each 512-bit block with the compression function of 80 steps (four rounds of 20 steps).

  • Split the block into sixteen 32-bit words W0,…,W15W_0, \dots, W_{15} and expand to 80 words: Wt=(Wt−3⊕Wt−8⊕Wt−14⊕Wt−16)⋘1,16≤t≤79W_t = (W_{t-3} \oplus W_{t-8} \oplus W_{t-14} \oplus W_{t-16}) \lll 1, \quad 16 \le t \le 79
  • For each step t=0,…,79t = 0, \dots, 79: TEMP=(A⋘5)+ft(B,C,D)+E+Wt+Kt\text{TEMP} = (A \lll 5) + f_t(B, C, D) + E + W_t + K_t E=D,  D=C,  C=B⋘30,  B=A,  A=TEMPE = D,\; D = C,\; C = B \lll 30,\; B = A,\; A = \text{TEMP} (all additions are modulo 2322^{32}).
Stepsft(B,C,D)f_t(B,C,D)KtK_t
0-19(B∧C)∨(¬B∧D)(B \land C) \lor (\lnot B \land D)5A827999
20-39B⊕C⊕DB \oplus C \oplus D6ED9EBA1
40-59(B∧C)∨(B∧D)∨(C∧D)(B \land C) \lor (B \land D) \lor (C \land D)8F1BBCDC
60-79B⊕C⊕DB \oplus C \oplus DCA62C1D6
  • After the 80 steps, add the results to the chaining values: H0=H0+AH_0 = H_0 + A, H1=H1+BH_1 = H_1 + B, and so on for C,D,EC, D, E (mod 2322^{32}). These become the input for the next block.

Step 5: Output. After the last block, the concatenation H0∥H1∥H2∥H3∥H4H_0 \| H_1 \| H_2 \| H_3 \| H_4 is the 160-bit message digest.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 10 marks

Show that Z 5is a field. John publishes the ElGamal public key (q, α, YA) =(101, 2, 14). Jane desired to send the secret message CSIT to John. Using the equivalence A = 0, B=1, … , Z=25, encrypt the message using John’s public key. Use a random number k = 4.

Answer

(Z5_5 is a field)

Z5={0,1,2,3,4}Z_5 = \{0,1,2,3,4\} with addition and multiplication modulo 5. It is a field if it is a commutative ring with unity in which every non-zero element has a multiplicative inverse.

  • Under addition mod 5: closure, associativity and commutativity hold; the identity is 0; the inverse of aa is 5−a5-a (0 for 0). So it is an abelian group.
  • Under multiplication mod 5: closure, associativity, commutativity hold; the identity is 1; and multiplication distributes over addition.
  • Inverses of the non-zero elements:

1⋅1=1,2⋅3=6≡1,3⋅2≡1,4⋅4=16≡1(mod5)1\cdot1 = 1,\quad 2\cdot3 = 6 \equiv 1,\quad 3\cdot2 \equiv 1,\quad 4\cdot4 = 16 \equiv 1 \pmod 5

Every non-zero element has an inverse, so Z5Z_5 is a field. This holds because 5 is prime, so gcd⁡(a,5)=1\gcd(a,5)=1 for every a≠0a \ne 0.

(ElGamal encryption)

Public key: q=101q = 101, α=2\alpha = 2, YA=14Y_A = 14. Random k=4k = 4.

Message CSIT with A=0, ..., Z=25: C = 2, S = 18, I = 8, T = 19.

One-time key: K=YA k mod q=144 mod 101K = Y_A^{\,k} \bmod q = 14^4 \bmod 101 142=196≡9514^2 = 196 \equiv 95, and 952=9025=89⋅101+3695^2 = 9025 = 89\cdot101 + 36, so K=36K = 36.

C1=αk mod q=24=16C_1 = \alpha^k \bmod q = 2^4 = 16

C2=M⋅K mod 101C_2 = M \cdot K \bmod 101 for each letter:

LetterMMC2=36M mod 101C_2 = 36M \bmod 101
C272
S18648−6⋅101=42648 - 6\cdot101 = 42
I8288−2⋅101=86288 - 2\cdot101 = 86
T19684−6⋅101=78684 - 6\cdot101 = 78

Ciphertext: (16,72), (16,42), (16,86), (16,78)(16, 72),\ (16, 42),\ (16, 86),\ (16, 78).

(Decryption: K=C1XA mod qK = C_1^{X_A} \bmod q and M=C2K−1 mod qM = C_2 K^{-1} \bmod q, using the same K=36K = 36.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Differentiate between Trojan horse and virus. Describe any two types of intruders.

Answer

(Trojan horse vs virus)

BasisTrojan horseVirus
DefinitionA program that appears useful but contains hidden malicious codeA program fragment that attaches itself to other programs or files
ReplicationDoes not replicate itselfReplicates by infecting other files
SpreadThe user is tricked into running itSpreads when the infected host program is executed or shared
Host neededStands alone as a disguised programNeeds a host file
PurposeBackdoors, data theft, performs unauthorised actionsCorrupts or destroys data, consumes resources

(Types of intruders)

  1. Masquerader: an outsider (not authorised to use the system) who penetrates the access controls, often by using a legitimate user's stolen account or password, to use that account.
  2. Misfeasor: a legitimate user who accesses data, programs or resources for which access is not authorised, or who misuses privileges.
  3. Clandestine user: an individual (insider or outsider) who seizes supervisory control of the system and uses it to evade auditing and access controls or to suppress audit collection.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

The message “IMOGUN” was encrypted with a Playfair cipher using keyword “GALOIS”. Decrypt the message.

Answer

Playfair key square for keyword GALOIS (I and J share a cell). Write the keyword without repeats, then the rest of the alphabet:

GALOI
SBCDE
FHKMN
PQRTU
VWXYZ

Decryption rules: same row, take the letter to the left of each; same column, take the letter above each; otherwise take the letter in its own row and the column of the other letter.

Digraphs of IMOGUN: IM, OG, UN.

  • IM: I is at row 1, column 5; M is at row 3, column 4. Different row and column (rectangle): I takes the letter in row 1, column 4 = O; M takes row 3, column 5 = N. So ON.
  • OG: O and G are both in row 1, so move left: O gives L, and G wraps to the right end giving I. So LI.
  • UN: U is at row 4, column 5; N is at row 3, column 5. Same column, move up. Column 5 reads I, E, N, U, Z, so the letter above U is N and the letter above N is E. So NE.

Plaintext: ON LI NE = ONLINE.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

How encryption is done using IDEA algorithm.

Answer

IDEA (International Data Encryption Algorithm) is a symmetric block cipher that encrypts a 64-bit block using a 128-bit key. It has 8 identical rounds followed by a final output transformation. It mixes three incompatible group operations on 16-bit words: bitwise XOR (⊕\oplus), addition modulo 2162^{16} (⊞\boxplus), and multiplication modulo 216+12^{16}+1 (⊙\odot, where the all-zero word is treated as 2162^{16}).

Key schedule. 52 subkeys of 16 bits are produced: six per round (K1(r),…,K6(r)K_1^{(r)}, \dots, K_6^{(r)} for 8 rounds = 48) and four for the output transformation. The 128-bit key is split into the first eight 16-bit subkeys; the key is then rotated left by 25 bits and split again for the next eight, and so on.

One round. The 64-bit block is split into four 16-bit sub-blocks X1,X2,X3,X4X_1, X_2, X_3, X_4. With the six round subkeys K1,…,K6K_1, \dots, K_6:

  1. A=X1⊙K1A = X_1 \odot K_1
  2. B=X2⊞K2B = X_2 \boxplus K_2
  3. C=X3⊞K3C = X_3 \boxplus K_3
  4. D=X4⊙K4D = X_4 \odot K_4
  5. E=A⊕CE = A \oplus C
  6. F=B⊕DF = B \oplus D
  7. G1=E⊙K5G_1 = E \odot K_5, then G2=F⊞G1G_2 = F \boxplus G_1, then G3=G2⊙K6G_3 = G_2 \odot K_6, and finally G4=G1⊞G3G_4 = G_1 \boxplus G_3
  8. Outputs: W1=A⊕G3W_1 = A \oplus G_3, W2=C⊕G3W_2 = C \oplus G_3, W3=B⊕G4W_3 = B \oplus G_4, W4=D⊕G4W_4 = D \oplus G_4

The two middle sub-blocks are swapped, so the next round's input is (W1,W3,W2,W4)(W_1, W_3, W_2, W_4).

Output transformation (after round 8). The middle blocks are not swapped back (undoing the last swap), and Y1=W1⊙K1,Y2=W3⊞K2,Y3=W2⊞K3,Y4=W4⊙K4Y_1 = W_1 \odot K_1,\quad Y_2 = W_3 \boxplus K_2,\quad Y_3 = W_2 \boxplus K_3,\quad Y_4 = W_4 \odot K_4 using the last four subkeys. Y1∥Y2∥Y3∥Y4Y_1\|Y_2\|Y_3\|Y_4 is the 64-bit ciphertext. Decryption uses the same structure with subkeys that are the multiplicative or additive inverses of the encryption subkeys in reverse order.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Describe the services provided by Pretty Good Privacy protocol to secure email.

Answer

Pretty Good Privacy (PGP) provides confidentiality and authentication for email and file storage. It offers five services:

  1. Authentication (digital signature). The sender computes a SHA-1 hash of the message, encrypts it with the sender's RSA/DSS private key, and attaches it to the message. The receiver decrypts it with the sender's public key and compares it with a hash of the received message. This proves the sender's identity and message integrity.

  2. Confidentiality (encryption). The sender generates a random one-time session key, encrypts the message with it using a symmetric cipher (CAST-128, IDEA or 3DES), and encrypts the session key with the recipient's public key (RSA or ElGamal). Both are sent together. Only the recipient can recover the session key.

  3. Compression. The message is compressed with ZIP after the signature is generated and before encryption. This saves transmission space and removes redundancy, which strengthens encryption.

  4. E-mail compatibility. Encrypted output is binary, which many mail systems cannot carry. PGP converts the raw 8-bit binary stream to printable ASCII using Radix-64 (Base64) encoding, which expands the data by about 33%.

  5. Segmentation and reassembly. Mail systems limit message length (often 50,000 octets). PGP breaks long messages into smaller segments and reassembles them at the receiver.

Both services can be combined: sign first, then compress, then encrypt, then Radix-64 convert.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Define challenge response system. Why do we need Kerberos?

Answer

(Challenge-response system)

A challenge-response authentication system is one in which the verifier sends the claimant an unpredictable value (a challenge, usually a random nonce), and the claimant proves knowledge of a secret by returning a response computed from the challenge and the secret, without revealing the secret. For example:

  1. Verifier sends random RR to the user.
  2. The user returns EK(R)E_K(R), or H(K∥R)H(K \| R), where KK is the shared secret.
  3. The verifier computes the same value and compares.

Because each challenge is fresh, an eavesdropper cannot reuse a recorded response (protection against replay attacks), and the password is never sent over the network.

(Why Kerberos is needed)

In an open distributed network, workstations are untrusted and users access many servers. Problems with the alternatives are:

  • Sending the password to each server in the clear is insecure, and storing each user's password on every server is unmanageable.
  • A workstation may impersonate another user, a user may spoof a workstation's network address, and eavesdroppers can replay captured messages.

Kerberos solves this with a trusted third party, based on symmetric encryption:

  • Single sign-on: the user enters the password once, then gets a ticket-granting ticket (TGT) from the Authentication Server, and later gets service tickets from the Ticket Granting Server. The password never travels the network.
  • Mutual authentication between client and server, using tickets and authenticators with timestamps against replay.
  • Centralised key management: the Kerberos server shares a secret key with each user and each service, and issues session keys.

It therefore provides secure, scalable authentication for client-server systems.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

How direct digital signature different from arbitrated digital signature? How digital signature generation and verification is done using RSA.

Answer

(Direct vs arbitrated digital signature)

BasisDirect digital signatureArbitrated digital signature
PartiesOnly sender and receiverSender, receiver and a trusted arbiter
ProcessSender signs the message (or its hash) with his private key; receiver verifies with the sender's public keySender sends the signed message to the arbiter, who checks it and forwards it with a timestamp to the receiver
TrustReceiver trusts the sender's keyBoth parties trust the arbiter
WeaknessSender can deny by claiming the private key was stolen or lost; depends on timestampsArbiter becomes a bottleneck and must be trusted fully
StrengthSimpleSolves repudiation and timing disputes

(RSA signature generation and verification)

Key generation: choose primes p,qp, q; n=pqn = pq; ϕ(n)=(p−1)(q−1)\phi(n) = (p-1)(q-1); choose ee with gcd⁡(e,ϕ(n))=1\gcd(e,\phi(n)) = 1; compute d=e−1 mod ϕ(n)d = e^{-1} \bmod \phi(n). Public key (e,n)(e, n), private key (d,n)(d, n).

Signing (by sender A):

  1. Compute the hash of the message: h=H(M)h = H(M).
  2. Compute the signature using A's private key: S=hd mod nS = h^{d} \bmod n
  3. Send MM and SS.

Verification (by receiver B):

  1. Compute the hash of the received message: h′=H(M)h' = H(M).
  2. Recover with A's public key: h=Se mod nh = S^{e} \bmod n
  3. If h=h′h = h', the signature is valid (message is authentic and unaltered); otherwise it is rejected.

Only A knows dd, so only A could have produced SS.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Why do we need discrete logarithm over normal logarithm? Find out whether 3 is primitive root of 7 or not.

Answer

(Need for discrete logarithms)

An ordinary logarithm log⁡ba\log_b a is a continuous, monotonic function and is easy to compute (for example, by numerical methods) from the size of aa. In modular arithmetic, y=gx mod py = g^x \bmod p jumps around erratically, with no ordering or trend that reveals xx. Finding xx given g,y,pg, y, p (the discrete logarithm problem) has no known efficient algorithm for large pp, whereas computing gx mod pg^x \bmod p is fast (square-and-multiply). This one-way property makes discrete logarithms the basis for Diffie-Hellman, ElGamal and DSA. Normal logarithms give no such hardness, so they cannot be used for security.

(Is 3 a primitive root of 7?)

A primitive root of 7 must generate all of {1,…,6}\{1,\dots,6\} as its powers, that is have order ϕ(7)=6\phi(7) = 6.

31=3,32=9≡2,33=6,34=18≡4,35=12≡5,36=15≡1(mod7)3^1 = 3,\quad 3^2 = 9 \equiv 2,\quad 3^3 = 6,\quad 3^4 = 18 \equiv 4,\quad 3^5 = 12 \equiv 5,\quad 3^6 = 15 \equiv 1 \pmod 7

The powers 3,2,6,4,5,13, 2, 6, 4, 5, 1 are all distinct and cover every non-zero residue. Hence 3 is a primitive root of 7.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Which one is more secure, monoalphabetic cipher or poly alphabetic cipher? Justify. Using rail fence cipher encrypt the text “LEARNING AND TEACHING ARE DIFFERENT” using 3 as rails.

Answer

(Monoalphabetic vs polyalphabetic)

A polyalphabetic cipher (for example Vigenere) is more secure than a monoalphabetic cipher (for example Caesar or general substitution).

  • In a monoalphabetic cipher each plaintext letter always maps to the same ciphertext letter, so the letter-frequency distribution of the plaintext survives in the ciphertext. Frequency analysis (E, T, A being most common in English) breaks it easily, even though the key space (26!26!) is large.
  • A polyalphabetic cipher uses several substitution alphabets chosen by key letters, so the same plaintext letter is encrypted differently at different positions. This flattens the frequency distribution and hides the statistics, making cryptanalysis much harder (it requires finding the key length first, e.g. by Kasiski or index of coincidence).

(Rail fence, 3 rails)

Remove spaces: LEARNINGANDTEACHINGAREDIFFERENT (31 letters). Write in zigzag over 3 rails:

Rail 1 (positions 1, 5, 9, ...): L N A E I R F E Rail 2 (positions 2, 4, 6, ...): E R I G N T A H N A E I F R N Rail 3 (positions 3, 7, 11, ...): A N D C G D E T

Read row by row:

  • Rail 1: LNAEIRFE
  • Rail 2: ERIGNTAHNAEIFRN
  • Rail 3: ANDCGDET

Ciphertext: LNAEIRFEERIGNTAHNAEIFRNANDCGDET

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

What is the condition of for two integers, x and y, to be relatively prime? Find whether 61 is prime or not using Miller-Rabin algorithm.

Answer

(Relatively prime)

Two integers xx and yy are relatively prime (coprime) if their only positive common divisor is 1, that is gcd⁡(x,y)=1.\gcd(x, y) = 1.

(Miller-Rabin test for 61)

Write n−1=60=2kqn - 1 = 60 = 2^k q with qq odd: 60=22⋅1560 = 2^2 \cdot 15, so k=2k = 2, q=15q = 15.

Choose a base aa (with 1<a<n−11 < a < n-1). Compute aq mod na^q \bmod n. If it is 11 or n−1=60n-1 = 60, the test says "inconclusive (probably prime)". Otherwise square up to k−1k-1 times looking for 6060; if 6060 never appears, nn is composite.

Base a=2a = 2: 215 mod 612^{15} \bmod 61: 26=64≡32^6 = 64 \equiv 3, so 212≡92^{12} \equiv 9, 215=212⋅23≡72≡112^{15} = 2^{12}\cdot 2^3 \equiv 72 \equiv 11. Not 1 or 60, so square: 112=121≡121−61=60≡−111^2 = 121 \equiv 121 - 61 = 60 \equiv -1. We find −1-1 at j=1j = 1, so the test passes for a=2a=2.

Base a=3a = 3 (second check): 315 mod 613^{15} \bmod 61: 35=243≡243−183=60≡−13^5 = 243 \equiv 243 - 183 = 60 \equiv -1, so 315=(35)3≡(−1)3=−1=603^{15} = (3^5)^3 \equiv (-1)^3 = -1 = 60. This equals n−1n-1, so inconclusive (passes).

Both bases pass, and no witness for compositeness is found. Hence 61 is (probably) prime. Indeed 61 has no divisor up to 61≈7.8\sqrt{61}\approx 7.8 (not divisible by 2, 3, 5, 7), so it is truly prime.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 10 marks

Define discrete logarithms. How key generation, encryption and decryption is done in RSA. In a RSA cryptosystem, given p=13 and q=7, determine private key, public key and perform encryption and decryption for the text M=”hi” using 0 to 25 for letters from a to z.

Answer

(Discrete logarithm)

For a prime pp with primitive root gg, every yy in {1,…,p−1}\{1,\dots,p-1\} can be written y≡gx(modp)y \equiv g^x \pmod p for a unique xx in [0,p−2][0, p-2]. This xx is the discrete logarithm (index) of yy to base gg mod pp, written x=dlogg,p(y)x = \text{dlog}_{g,p}(y). Computing gx mod pg^x \bmod p is easy, but finding xx from yy is computationally infeasible for large pp. This is the basis of Diffie-Hellman and ElGamal.

(RSA algorithm)

Key generation:

  1. Choose two large primes pp and qq.
  2. Compute n=pqn = pq and ϕ(n)=(p−1)(q−1)\phi(n) = (p-1)(q-1).
  3. Choose ee with 1<e<ϕ(n)1 < e < \phi(n) and gcd⁡(e,ϕ(n))=1\gcd(e, \phi(n)) = 1.
  4. Compute d≡e−1(modϕ(n))d \equiv e^{-1} \pmod{\phi(n)}.
  5. Public key PU={e,n}PU = \{e, n\}; private key PR={d,n}PR = \{d, n\}.

Encryption: for plaintext M<nM < n, ciphertext C=Me mod nC = M^{e} \bmod n.

Decryption: M=Cd mod nM = C^{d} \bmod n.

This works because ed≡1(modϕ(n))ed \equiv 1 \pmod{\phi(n)} and Euler's theorem gives Med≡M(modn)M^{ed} \equiv M \pmod n.

(Numerical problem, p=13p = 13, q=7q = 7)

n=13×7=91,ϕ(n)=12×6=72n = 13 \times 7 = 91,\qquad \phi(n) = 12 \times 6 = 72

Choose e=5e = 5 (gcd⁡(5,72)=1\gcd(5,72)=1). Find dd with 5d≡1(mod72)5d \equiv 1 \pmod{72}: 5×29=145=2×72+15 \times 29 = 145 = 2\times72 + 1, so d=29d = 29.

  • Public key: {5,91}\{5, 91\}
  • Private key: {29,91}\{29, 91\}

Message "hi" with a=0, ..., z=25: h = 7, i = 8.

Encryption:

  • C1=75 mod 91C_1 = 7^5 \bmod 91: 72=497^2 = 49, 73=343≡343−273=707^3 = 343 \equiv 343 - 273 = 70, 74=490≡490−455=357^4 = 490 \equiv 490 - 455 = 35, 75=245≡245−182=637^5 = 245 \equiv 245 - 182 = 63. So C1=63C_1 = 63.
  • C2=85 mod 91C_2 = 8^5 \bmod 91: 82=648^2 = 64, 83=512≡512−455=578^3 = 512 \equiv 512 - 455 = 57, 84=456≡456−455=18^4 = 456 \equiv 456 - 455 = 1, 85≡88^5 \equiv 8. So C2=8C_2 = 8.

Ciphertext: (63,8)(63, 8).

Decryption:

  • 6329 mod 9163^{29} \bmod 91. Use the Chinese remainder theorem: mod 7, 63≡063 \equiv 0 so the result is 00; mod 13, 63≡11≡−263 \equiv 11 \equiv -2 and (−2)29=(−2)24⋅(−2)5≡1⋅(−32)≡−32+39=7(mod13)(-2)^{29} = (-2)^{24}\cdot(-2)^5 \equiv 1\cdot(-32) \equiv -32 + 39 = 7 \pmod{13} (using a12≡1a^{12}\equiv1). The number congruent to 0 mod 70 \bmod 7 and 7 mod 137 \bmod 13 is 77. So M1=7M_1 = 7 = h.
  • 829 mod 918^{29} \bmod 91: since 84≡18^4 \equiv 1, 829=828⋅8≡88^{29} = 8^{28}\cdot 8 \equiv 8. So M2=8M_2 = 8 = i.

Recovered plaintext: 7, 8 = "hi".

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 10 marks

Write down the encryption and decryption process at 2-DES and 3-DES. Explain the Fiestal cipher structure. Divide 5x^2 + 4x + 6 by 2x + 1 over GF(7).

Answer

(2-DES and 3-DES)

Double DES applies DES twice with two different keys K1,K2K_1, K_2 (112-bit key):

C=EK2(EK1(P)),P=DK1(DK2(C))C = E_{K_2}\big(E_{K_1}(P)\big),\qquad P = D_{K_1}\big(D_{K_2}(C)\big)

Its effective strength is only about 2572^{57} operations rather than 21122^{112} because of the meet-in-the-middle attack: given a known pair (P,C)(P, C), the attacker encrypts PP under all 2562^{56} keys K1K_1, decrypts CC under all 2562^{56} keys K2K_2, and looks for a matching middle value X=EK1(P)=DK2(C)X = E_{K_1}(P) = D_{K_2}(C).

Triple DES (3DES, EDE mode) with two or three keys:

C=EK3(DK2(EK1(P))),P=DK1(EK2(DK3(C)))C = E_{K_3}\Big(D_{K_2}\big(E_{K_1}(P)\big)\Big),\qquad P = D_{K_1}\Big(E_{K_2}\big(D_{K_3}(C)\big)\Big)

With two keys, K3=K1K_3 = K_1. The middle step is decryption so that with K1=K2K_1=K_2 it reduces to single DES (backward compatibility). It resists the meet-in-the-middle attack (effective key length 112 bits with two keys, 168 with three).

(Feistel cipher structure)

A Feistel network is the general design of many block ciphers (DES, Blowfish). The plaintext block is split into a left half L0L_0 and a right half R0R_0. There are nn rounds, each using a subkey KiK_i derived from the main key:

Li=Ri−1,Ri=Li−1⊕F(Ri−1,Ki)L_i = R_{i-1},\qquad R_i = L_{i-1} \oplus F(R_{i-1}, K_i)

After the last round the halves are swapped, giving the ciphertext (Rn,Ln)(R_n, L_n). Decryption uses the same structure with subkeys in reverse order Kn,…,K1K_n,\dots,K_1. The function FF need not be invertible, which is the main advantage. Security depends on block size, key size, number of rounds, round function and key schedule. Confusion and diffusion are achieved through substitution and permutation in FF.

(Polynomial division over GF(7))

Divide 5x2+4x+65x^2 + 4x + 6 by 2x+12x + 1. In GF(7), 2−1=42^{-1} = 4 (since 2⋅4=8≡12\cdot4 = 8 \equiv 1).

  • First term: 5x2÷2x=5⋅4 x=20x≡6x5x^2 \div 2x = 5\cdot4\,x = 20x \equiv 6x. Multiply: 6x(2x+1)=12x2+6x≡5x2+6x6x(2x+1) = 12x^2 + 6x \equiv 5x^2 + 6x. Subtract: (5x2+4x+6)−(5x2+6x)=−2x+6≡5x+6(5x^2 + 4x + 6) - (5x^2 + 6x) = -2x + 6 \equiv 5x + 6.
  • Second term: 5x÷2x=5⋅4=20≡65x \div 2x = 5\cdot4 = 20 \equiv 6. Multiply: 6(2x+1)=12x+6≡5x+66(2x+1) = 12x + 6 \equiv 5x + 6. Subtract: (5x+6)−(5x+6)=0(5x + 6) - (5x + 6) = 0.

Quotient=6x+6,Remainder=0.\text{Quotient} = 6x + 6,\qquad \text{Remainder} = 0.

Check: (2x+1)(6x+6)=12x2+18x+6≡5x2+4x+6(mod7)(2x+1)(6x+6) = 12x^2 + 18x + 6 \equiv 5x^2 + 4x + 6 \pmod 7.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 10 marks

What are the applications of hash functions? Discuss how SHA-1 algorithm generates hash value from a given message.

Answer

(Applications of hash functions)

  1. Message authentication / integrity: a digest sent with, or protected along with, a message detects any modification (basis of HMAC and MAC schemes).
  2. Digital signatures: the digest, not the whole message, is signed with a private key (RSA, DSA), which is faster and shorter.
  3. Password storage: systems store H(password ∥ salt)H(\text{password}\,\|\,\text{salt}) rather than the password.
  4. One-way password files and one-time passwords: for example S/KEY uses repeated hashing.
  5. Intrusion and virus detection: file hashes are stored and compared later to detect changes (tripwire-style tools).
  6. Pseudorandom number generation and key derivation: a hash is used to derive keys from seeds or passwords.
  7. Data structures and deduplication: checksums, hash tables, blockchain block linking, file identification.

(SHA-1 algorithm)

SHA-1 produces a 160-bit digest from a message shorter than 2642^{64} bits, processing 512-bit blocks.

  1. Padding: append bit 1, then zeros until the length is 448 mod 512448 \bmod 512.
  2. Length field: append the original length as a 64-bit value, so the total is a multiple of 512 bits.
  3. Initial values: five 32-bit registers H0=67452301,  H1=EFCDAB89,  H2=98BADCFE,  H3=10325476,  H4=C3D2E1F0H_0 = \text{67452301},\; H_1 = \text{EFCDAB89},\; H_2 = \text{98BADCFE},\; H_3 = \text{10325476},\; H_4 = \text{C3D2E1F0}
  4. Message schedule: each 512-bit block gives W0,…,W15W_0,\dots,W_{15}; for t=16,…,79t = 16,\dots,79 Wt=(Wt−3⊕Wt−8⊕Wt−14⊕Wt−16)⋘1W_t = (W_{t-3} \oplus W_{t-8} \oplus W_{t-14} \oplus W_{t-16}) \lll 1
  5. Compression: set A,B,C,D,EA,B,C,D,E to H0,…,H4H_0,\dots,H_4. For each of 80 steps (4 rounds of 20): T=(A⋘5)+ft(B,C,D)+E+Wt+Kt(mod232)T = (A \lll 5) + f_t(B,C,D) + E + W_t + K_t \pmod{2^{32}} E←D,  D←C,  C←B⋘30,  B←A,  A←TE \leftarrow D,\; D \leftarrow C,\; C \leftarrow B \lll 30,\; B \leftarrow A,\; A \leftarrow T
Roundftf_tKtK_t
1 (0-19)(B∧C)∨(¬B∧D)(B\land C)\lor(\lnot B\land D)5A827999
2 (20-39)B⊕C⊕DB\oplus C\oplus D6ED9EBA1
3 (40-59)(B∧C)∨(B∧D)∨(C∧D)(B\land C)\lor(B\land D)\lor(C\land D)8F1BBCDC
4 (60-79)B⊕C⊕DB\oplus C\oplus DCA62C1D6
  1. Update chaining values: H0+=AH_0 \mathrel{+}= A, H1+=BH_1 \mathrel{+}= B, H2+=CH_2 \mathrel{+}= C, H3+=DH_3 \mathrel{+}= D, H4+=EH_4 \mathrel{+}= E.
  2. Output: after the last block, H0∥H1∥H2∥H3∥H4H_0\|H_1\|H_2\|H_3\|H_4 is the digest.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

Show encryption and decryption of “csit” using hill cipher having key, k=
32
57

Answer

Key and inverse. With A=0, ..., Z=25, K=(3257),det⁡K=21−10=11.K = \begin{pmatrix} 3 & 2 \\ 5 & 7 \end{pmatrix},\qquad \det K = 21 - 10 = 11.

11−1 mod 26=1911^{-1} \bmod 26 = 19 since 11×19=209=8×26+111 \times 19 = 209 = 8\times26 + 1. The inverse is K−1=19(7−2−53) mod 26=(133−38−9557) mod 26=(31495).K^{-1} = 19\begin{pmatrix} 7 & -2 \\ -5 & 3 \end{pmatrix} \bmod 26 = \begin{pmatrix} 133 & -38 \\ -95 & 57 \end{pmatrix} \bmod 26 = \begin{pmatrix} 3 & 14 \\ 9 & 5 \end{pmatrix}.

Encryption. "csit" gives pairs (c,s)=(2,18)(c,s) = (2,18) and (i,t)=(8,19)(i,t) = (8,19). Using C=KP mod 26C = K P \bmod 26 on column vectors:

(3257)(218)=(6+3610+126)=(42136)≡(166)→QG\begin{pmatrix} 3 & 2 \\ 5 & 7 \end{pmatrix}\begin{pmatrix} 2 \\ 18 \end{pmatrix} = \begin{pmatrix} 6 + 36 \\ 10 + 126 \end{pmatrix} = \begin{pmatrix} 42 \\ 136 \end{pmatrix} \equiv \begin{pmatrix} 16 \\ 6 \end{pmatrix} \to \text{QG}

(3257)(819)=(24+3840+133)=(62173)≡(1017)→KR\begin{pmatrix} 3 & 2 \\ 5 & 7 \end{pmatrix}\begin{pmatrix} 8 \\ 19 \end{pmatrix} = \begin{pmatrix} 24 + 38 \\ 40 + 133 \end{pmatrix} = \begin{pmatrix} 62 \\ 173 \end{pmatrix} \equiv \begin{pmatrix} 10 \\ 17 \end{pmatrix} \to \text{KR}

Ciphertext: QGKR.

Decryption. P=K−1C mod 26P = K^{-1} C \bmod 26:

(31495)(166)=(48+84144+30)=(132174)≡(218)→cs\begin{pmatrix} 3 & 14 \\ 9 & 5 \end{pmatrix}\begin{pmatrix} 16 \\ 6 \end{pmatrix} = \begin{pmatrix} 48 + 84 \\ 144 + 30 \end{pmatrix} = \begin{pmatrix} 132 \\ 174 \end{pmatrix} \equiv \begin{pmatrix} 2 \\ 18 \end{pmatrix} \to \text{cs}

(31495)(1017)=(30+23890+85)=(268175)≡(819)→it\begin{pmatrix} 3 & 14 \\ 9 & 5 \end{pmatrix}\begin{pmatrix} 10 \\ 17 \end{pmatrix} = \begin{pmatrix} 30 + 238 \\ 90 + 85 \end{pmatrix} = \begin{pmatrix} 268 \\ 175 \end{pmatrix} \equiv \begin{pmatrix} 8 \\ 19 \end{pmatrix} \to \text{it}

Recovered plaintext: csit.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

Give the formal definition of authentication system. Describe about one way and mutual authentication system.

Answer

(Formal definition of an authentication system)

An authentication system is a 5-tuple (A,C,F,L,S)(A, C, F, L, S) where:

  • AA is the set of authentication information (for example passwords, keys) that entities use to prove identity,
  • CC is the set of complementary information stored by the system to validate the authentication information,
  • FF is the set of complementation functions, f:A→Cf: A \to C, that produce the complementary information from the authentication information,
  • LL is the set of authentication functions, l:A×C→{true,false}l: A \times C \to \{\text{true}, \text{false}\}, that verify identity,
  • SS is the set of selection functions that let an entity create or alter AA and CC.

A user presents a∈Aa \in A; the system computes f(a)f(a) and checks that l(a,c)l(a, c) is true for the stored c∈Cc \in C. For example, with a hashed password file, ff is the hash function and ll compares the hashes.

(One-way authentication)

Only one party authenticates itself to the other, for example a client proves its identity to a server (password login). The server is not verified. It is simple but vulnerable to a fake server. In a protocol, the claimant sends identity plus proof (a password, or a response to a nonce/timestamp), and the verifier checks it. Typical use: email systems and one-way authentication of A to B with a timestamp or a nonce.

(Mutual authentication)

Both parties verify each other's identity before communicating, for example client and server, using challenge-response with nonces:

  1. A →\to B: IDAID_A, nonce NAN_A
  2. B →\to A: EK(NA,NB)E_K(N_A, N_B) (B proves it knows the key and challenges A)
  3. A →\to B: EK(NB)E_K(N_B) (A proves its identity)

It defends against impersonation of either side and against replay attacks. Kerberos and SSL/TLS use mutual authentication.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

List the stage of certificate life cycle. What are the types of firewalls?

Answer

(Stages of the certificate life cycle)

  1. Registration / initialisation: the subject proves identity to the registration authority and key pair generation takes place.
  2. Certification (issuance): the CA verifies the request, signs and issues the certificate binding the public key to the identity.
  3. Distribution / key pair recovery and storage: the certificate is published in a directory and delivered to the subscriber.
  4. Use / validation: the certificate is used for encryption, signing and authentication; relying parties validate the signature, validity period and revocation status.
  5. Revocation: the certificate is withdrawn before expiry if the key is compromised or the details change. It is listed on a CRL or checked via OCSP.
  6. Renewal / update: a new certificate is issued before the old one expires.
  7. Expiration / destruction: after the validity ends, the certificate is archived and the keys destroyed.

(Types of firewalls)

  1. Packet-filtering firewall: works at the network layer; accepts or drops each packet by rules on source/destination IP, port and protocol. Fast, but has no knowledge of connection state or application data.
  2. Stateful inspection firewall: keeps a table of active connections and allows packets that belong to a valid connection (for example TCP handshake state). More secure than simple filters.
  3. Application-level gateway (proxy firewall): works at the application layer; acts as a relay for specific services (HTTP, FTP), inspecting the content. Very secure but slower.
  4. Circuit-level gateway: works at the transport layer; relays TCP connections after checking the handshake, without examining the data (SOCKS).
  5. Next-generation firewall: combines the above with deep packet inspection, intrusion prevention and application awareness.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

What is malicious logic? How zombies are different from trojan horses?

Answer

(Malicious logic)

Malicious logic is hardware, software or firmware intentionally inserted into a system to perform an unauthorised process that violates the system's security policy and harms confidentiality, integrity or availability. Examples are Trojan horses, viruses, worms, logic bombs, zombies, rabbits and backdoors.

(Zombies vs Trojan horses)

BasisZombieTrojan horse
MeaningA compromised computer, secretly controlled remotely by an attacker, usually as part of a botnetA program that looks useful but carries hidden malicious code
PurposeLaunches attacks such as DDoS, sends spam, from an infected host on the attacker's commandPerforms unauthorised actions on the victim's system itself, such as stealing data or opening a backdoor
ControlWaits for commands from a command-and-control serverActs on its own logic, or opens access for the attacker
OriginA zombie is often the result of a Trojan, virus or worm infectionOne of the means of creating a zombie
VisibilityThe owner usually notices only slow performanceIs disguised as legitimate software to trick the user

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

How Miller Rabin test is used for primality testing? Show whether the number 561 passes the test.

Answer

(Miller-Rabin test)

Miller-Rabin is a probabilistic primality test. For odd n>2n > 2:

  1. Write n−1=2kqn - 1 = 2^k q with qq odd.
  2. Choose a random base aa, 1<a<n−11 < a < n-1.
  3. Compute x=aq mod nx = a^q \bmod n. If x=1x = 1 or x=n−1x = n-1, return "inconclusive" (possibly prime).
  4. Otherwise square repeatedly: for j=1,…,k−1j = 1,\dots,k-1 compute x←x2 mod nx \leftarrow x^2 \bmod n. If x=n−1x = n-1, return "inconclusive".
  5. If n−1n-1 is never reached, nn is definitely composite and aa is a witness.

If nn is prime, the test always returns inconclusive. If nn is composite, a random aa passes with probability at most 1/41/4, so repeating tt times reduces the error to 4−t4^{-t}.

(n = 561)

561=3×11×17561 = 3 \times 11 \times 17 is a Carmichael number (it passes the Fermat test for every base coprime to it). Write 560=24×35560 = 2^4 \times 35, so k=4k = 4, q=35q = 35.

Take a=2a = 2:

  • x0=235 mod 561=263x_0 = 2^{35} \bmod 561 = 263 (neither 1 nor 560)
  • x1=2632 mod 561=166x_1 = 263^2 \bmod 561 = 166
  • x2=1662 mod 561=67x_2 = 166^2 \bmod 561 = 67
  • x3=672 mod 561=1x_3 = 67^2 \bmod 561 = 1

The value 560≡−1560 \equiv -1 never occurred in the sequence 263,166,67263, 166, 67 (for j=0,1,2,3j = 0,1,2,3 the loop looks at x0,x1,x2,x3x_0, x_1, x_2, x_3 and none equals 560, and x3=1x_3 = 1). Moreover, 67 is a non-trivial square root of 1 modulo 561 (672≡167^2 \equiv 1 but 67≠±167 \ne \pm1), which is impossible for a prime.

Hence 561 does not pass the Miller-Rabin test; it is declared composite, with a=2a=2 as a witness. This shows Miller-Rabin catches Carmichael numbers that fool the Fermat test.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

Show that the set of integers is Ring under addition and multiplication.

Answer

A ring (R,+,×)(R, +, \times) is a set with two operations satisfying:

  • (R,+)(R, +) is an abelian group,
  • ×\times is closed and associative,
  • ×\times distributes over ++.

For the set of integers Z\mathbb{Z}:

Addition

  1. Closure: a+b∈Za + b \in \mathbb{Z} for all a,b∈Za, b \in \mathbb{Z}.
  2. Associativity: (a+b)+c=a+(b+c)(a + b) + c = a + (b + c).
  3. Identity: 0∈Z0 \in \mathbb{Z} and a+0=0+a=aa + 0 = 0 + a = a.
  4. Inverse: for each aa, −a∈Z-a \in \mathbb{Z} and a+(−a)=0a + (-a) = 0.
  5. Commutativity: a+b=b+aa + b = b + a.

Hence (Z,+)(\mathbb{Z}, +) is an abelian group.

Multiplication 6. Closure: a×b∈Za \times b \in \mathbb{Z}. 7. Associativity: (a×b)×c=a×(b×c)(a \times b) \times c = a \times (b \times c).

Distributivity 8. a×(b+c)=a×b+a×ca \times (b + c) = a\times b + a \times c and (a+b)×c=a×c+b×c(a + b)\times c = a\times c + b\times c.

All properties hold, so Z\mathbb{Z} is a ring. In addition, multiplication is commutative (ab=baab = ba) and has identity 1, so it is a commutative ring with unity, and has no zero divisors (an integral domain). It is not a field because, for example, 2 has no integer multiplicative inverse.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

How substitution ciphers are different from transposition ciphers? Given a message M=”CSIT PROGRAM IS A HOT CAKE”, encrypt M using Rail Fence cipher with rail size 3.

Answer

(Substitution vs transposition ciphers)

BasisSubstitution cipherTransposition cipher
PrincipleEach plaintext letter (or group) is replaced by another symbolThe positions of letters are rearranged; the letters themselves are unchanged
LettersIdentity changes, order is keptIdentity is kept, order changes
FrequencyLetter frequencies are altered (hidden in polyalphabetic types)Letter frequencies are exactly the same as in the plaintext
ExamplesCaesar, Playfair, Hill, VigenereRail fence, columnar transposition
PropertyProvides confusionProvides diffusion

(Rail fence, 3 rails)

Remove spaces: CSITPROGRAMISAHOTCAKE (21 letters). Zigzag on 3 rails:

  • Rail 1: C P R S T E
  • Rail 2: S T R G A I A O C K
  • Rail 3: I O M H A

Reading the rails in order gives:

Ciphertext: CPRSTESTRGAIAOCKIOMHA

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

Describe about IPSec. List the five services of PGP.

Answer

(IPSec)

IP Security (IPSec) is a suite of protocols that secures communication at the network (IP) layer, so all upper-layer applications (TCP, UDP, and so on) are protected transparently. It is used for VPNs and secure branch-office connectivity. Its components are:

  • Authentication Header (AH): provides data integrity, origin authentication and anti-replay protection, but no encryption.
  • Encapsulating Security Payload (ESP): provides confidentiality (encryption) and optionally integrity and authentication.
  • Internet Key Exchange (IKE) and Security Associations (SA): an SA is a one-way logical relationship defining the algorithms and keys used; IKE negotiates and manages keys automatically.

It works in two modes: transport mode protects only the payload of the IP packet (host to host), and tunnel mode encapsulates and protects the entire original IP packet inside a new IP packet (gateway to gateway, used for VPNs).

(Five services of PGP)

  1. Authentication (digital signature using SHA-1 and RSA/DSS)
  2. Confidentiality (symmetric encryption with a session key protected by public-key encryption)
  3. Compression (ZIP)
  4. E-mail compatibility (Radix-64 conversion)
  5. Segmentation and reassembly

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

How does meet in middle attack work in Diffie Helman key exchange protocol? Explain.

Answer

Diffie-Hellman key exchange. Public parameters are a prime qq and a primitive root α\alpha. A chooses a secret XAX_A and sends YA=αXA mod qY_A = \alpha^{X_A} \bmod q. B chooses XBX_B and sends YB=αXB mod qY_B = \alpha^{X_B} \bmod q. Both compute the shared key K=αXAXB mod qK = \alpha^{X_A X_B} \bmod q. The protocol is secure against passive eavesdroppers because of the discrete logarithm problem, but it has no authentication of the parties.

The man-in-the-middle attack. (This is the attack usually meant by "meet in middle" for Diffie-Hellman.) The attacker Darth intercepts the exchanged values:

  1. Darth generates two secrets XD1,XD2X_{D1}, X_{D2} and computes YD1=αXD1Y_{D1} = \alpha^{X_{D1}}, YD2=αXD2 mod qY_{D2} = \alpha^{X_{D2}} \bmod q.
  2. A sends YAY_A to B; Darth intercepts it and sends YD1Y_{D1} to B. Darth computes K2=YAXD2 mod qK_2 = Y_A^{X_{D2}} \bmod q.
  3. B sends YBY_B to A; Darth intercepts it and sends YD2Y_{D2} to A. Darth computes K1=YBXD1 mod qK_1 = Y_B^{X_{D1}} \bmod q.
  4. A computes K2=YD2XA mod qK_2 = Y_{D2}^{X_A} \bmod q, B computes K1=YD1XB mod qK_1 = Y_{D1}^{X_B} \bmod q.

Now A shares key K2K_2 with Darth and B shares key K1K_1 with Darth, while each believes they share a key with each other. Darth can decrypt each message from A with K2K_2, read or modify it, and re-encrypt it with K1K_1 for B (and the reverse), without either party noticing.

Countermeasure: authenticate the exchanged values with digital signatures, certificates or a pre-shared key (for example, authenticated Diffie-Hellman as in station-to-station protocol or IKE).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 10 marks

Let us consider the 4 bits key set as {1100, 1010, 0000, 1111, 0101, 1001} and input text as {1011, 1110, 1011, 1000}. Now trace the first full round operation of IDEA algorithm.

Answer

Here IDEA is scaled down to 4-bit words. The operations are: XOR (⊕\oplus); addition modulo 24=162^4 = 16 (⊞\boxplus); multiplication modulo 24+1=172^4+1 = 17 (⊙\odot), where the all-zero word 0000 is treated as 16 and a result of 16 is written back as 0000.

Subkeys of the round

K1=1100=12K_1 = 1100 = 12, K2=1010=10K_2 = 1010 = 10, K3=0000=0K_3 = 0000 = 0, K4=1111=15K_4 = 1111 = 15, K5=0101=5K_5 = 0101 = 5, K6=1001=9K_6 = 1001 = 9.

Input

X1=1011=11X_1 = 1011 = 11, X2=1110=14X_2 = 1110 = 14, X3=1011=11X_3 = 1011 = 11, X4=1000=8X_4 = 1000 = 8.

Round trace

  1. A=X1⊙K1=11×12=132 mod 17=13=1101A = X_1 \odot K_1 = 11 \times 12 = 132 \bmod 17 = 13 = 1101
  2. B=X2⊞K2=14+10=24 mod 16=8=1000B = X_2 \boxplus K_2 = 14 + 10 = 24 \bmod 16 = 8 = 1000
  3. C=X3⊞K3=11+0=11=1011C = X_3 \boxplus K_3 = 11 + 0 = 11 = 1011
  4. D=X4⊙K4=8×15=120 mod 17=1=0001D = X_4 \odot K_4 = 8 \times 15 = 120 \bmod 17 = 1 = 0001
  5. E=A⊕C=1101⊕1011=0110=6E = A \oplus C = 1101 \oplus 1011 = 0110 = 6
  6. F=B⊕D=1000⊕0001=1001=9F = B \oplus D = 1000 \oplus 0001 = 1001 = 9
  7. G1=E⊙K5=6×5=30 mod 17=13=1101G_1 = E \odot K_5 = 6 \times 5 = 30 \bmod 17 = 13 = 1101
  8. G2=F⊞G1=9+13=22 mod 16=6=0110G_2 = F \boxplus G_1 = 9 + 13 = 22 \bmod 16 = 6 = 0110
  9. G3=G2⊙K6=6×9=54 mod 17=3=0011G_3 = G_2 \odot K_6 = 6 \times 9 = 54 \bmod 17 = 3 = 0011
  10. G4=G1⊞G3=13+3=16 mod 16=0=0000G_4 = G_1 \boxplus G_3 = 13 + 3 = 16 \bmod 16 = 0 = 0000

Round outputs

  • W1=A⊕G3=1101⊕0011=1110W_1 = A \oplus G_3 = 1101 \oplus 0011 = 1110
  • W2=C⊕G3=1011⊕0011=1000W_2 = C \oplus G_3 = 1011 \oplus 0011 = 1000
  • W3=B⊕G4=1000⊕0000=1000W_3 = B \oplus G_4 = 1000 \oplus 0000 = 1000
  • W4=D⊕G4=0001⊕0000=0001W_4 = D \oplus G_4 = 0001 \oplus 0000 = 0001

After swapping the two middle blocks, the output of the first round (input to round 2) is

(1110, 1000, 1000, 0001).(1110,\ 1000,\ 1000,\ 0001).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 10 marks

What is Message Authentication Code? List the operation of computing digest value in different passes of MD4. Describe about Needhom-Schroeder protocol.

Answer

(Message Authentication Code)

A Message Authentication Code (MAC) is a short fixed-size tag computed from a message and a shared secret key, MAC=CK(M)\text{MAC} = C_K(M). The sender appends it to the message. The receiver, who has the same key, recomputes it and compares. A match proves the message was not altered (integrity) and came from someone holding the key (authentication). Unlike a plain hash, an attacker without the key cannot forge a valid MAC. Examples: CBC-MAC (DAA) and HMAC.

(MD4 digest computation)

MD4 produces a 128-bit digest from 512-bit blocks. The message is padded (1 followed by 0s to 448 mod 512448 \bmod 512, then a 64-bit length). The chaining variables A,B,C,DA,B,C,D (32 bits each) are initialised, and each block is processed in three passes of 16 steps each (48 steps). In each step one of the registers is updated as a←(a+f(b,c,d)+X[k]+t)⋘s.a \leftarrow (a + f(b,c,d) + X[k] + t) \lll s.

PassFunctionConstant ttOrder of message words X[k]X[k]Shifts ss
1F=(b∧c)∨(¬b∧d)F = (b\land c)\lor(\lnot b\land d)0k=0,1,2,…,15k = 0,1,2,\dots,153, 7, 11, 19 (repeating)
2G=(b∧c)∨(b∧d)∨(c∧d)G = (b\land c)\lor(b\land d)\lor(c\land d)5A827999k=0,4,8,12,1,5,9,13,2,6,10,14,3,7,11,15k = 0,4,8,12,1,5,9,13,2,6,10,14,3,7,11,153, 5, 9, 13
3H=b⊕c⊕dH = b\oplus c\oplus d6ED9EBA1k=0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15k = 0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,153, 9, 11, 15

After the three passes, the results are added to the values at the start of the block (A+=AAA \mathrel{+}= AA, and so on). The final A∥B∥C∥DA\|B\|C\|D is the digest.

(Needham-Schroeder protocol)

The Needham-Schroeder protocol (symmetric-key version) lets two parties A and B obtain a fresh shared session key KsK_s through a trusted Key Distribution Centre (KDC). A shares the master key KaK_a with the KDC, and B shares KbK_b.

  1. A →\to KDC: IDA ∥ IDB ∥ N1ID_A \,\|\, ID_B \,\|\, N_1 (request for a session key, with nonce N1N_1)
  2. KDC →\to A: EKa[Ks ∥ IDB ∥ N1 ∥ EKb[Ks ∥ IDA]]E_{K_a}\big[K_s \,\|\, ID_B \,\|\, N_1 \,\|\, E_{K_b}[K_s \,\|\, ID_A]\big]
  3. A →\to B: EKb[Ks ∥ IDA]E_{K_b}[K_s \,\|\, ID_A] (A forwards the ticket)
  4. B →\to A: EKs[N2]E_{K_s}[N_2] (B challenges A with nonce N2N_2)
  5. A →\to B: EKs[f(N2)]E_{K_s}[f(N_2)] (A answers with a function of N2N_2, such as N2−1N_2 - 1)

The nonce N1N_1 ensures that the reply in step 2 is fresh and matches the request; steps 4-5 confirm that both hold KsK_s. A known weakness is that step 3 can be replayed with a compromised old session key (it carries no timestamp), which Kerberos fixes by adding timestamps and lifetimes.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 10 marks

Why do we need discrete logarithm? Illustrate with an example. Consider a Diffie-Hellman scheme with a common prime p = 13 between user A and user B. Suppose public key of A is 10 and public key of B is 8. Now determine their private keys and shared secret key. Select any valid primitive root of 13.

Answer

Need for the discrete logarithm

Modular exponentiation y=ax mod py = a^x \bmod p is easy to compute (square-and-multiply needs about log⁡2x\log_2 x multiplications), but the reverse problem, finding xx from yy, aa and pp, has no known efficient algorithm when pp is large (hundreds of digits). This asymmetry is a one-way function, and it is the reason we need the discrete logarithm: the security of Diffie-Hellman key exchange, ElGamal encryption and DSA rests on the difficulty of computing it.

For a prime pp and a primitive root aa of pp, the powers a,a2,…,ap−1a, a^2, \dots, a^{p-1} are all distinct mod pp and produce every value 1…p−11 \dots p-1. So for any yy there is a unique exponent xx with 0≤x≤p−20 \le x \le p-2, called the discrete logarithm x=dlog⁡a,p(y)x = \operatorname{dlog}_{a,p}(y), i.e. ax≡y(modp)a^x \equiv y \pmod p.

Example: for p=7p = 7, a=3a = 3: 31=3, 32=2, 33=6, 34=4, 35=5, 36=13^1=3,\ 3^2=2,\ 3^3=6,\ 3^4=4,\ 3^5=5,\ 3^6=1. Given y=6y=6, dlog⁡3,7(6)=3\operatorname{dlog}_{3,7}(6)=3. For tiny pp we find it by trial, for a 2048-bit pp this is infeasible.

Diffie-Hellman with p=13p = 13

A primitive root of 13 is a=2a = 2. Its powers mod 13 are:

xx123456789101112
2x mod 132^x \bmod 13248361211951071

All values 1 to 12 appear, so 2 is a primitive root.

Private key of A. Public key YA=10=2XA mod 13Y_A = 10 = 2^{X_A} \bmod 13. From the table, XA=10X_A = 10.

Private key of B. Public key YB=8=2XB mod 13Y_B = 8 = 2^{X_B} \bmod 13. From the table, XB=3X_B = 3.

Shared secret key.

K=YBXA mod 13=810 mod 13K = Y_B^{X_A} \bmod 13 = 8^{10} \bmod 13

82=64≡128^2 = 64 \equiv 12, 84≡122=144≡18^4 \equiv 12^2 = 144 \equiv 1, so 810=88⋅82≡1⋅12=128^{10} = 8^8 \cdot 8^2 \equiv 1 \cdot 12 = 12.

Check from B's side:

K=YAXB mod 13=103=1000=76×13+12≡12K = Y_A^{X_B} \bmod 13 = 10^3 = 1000 = 76 \times 13 + 12 \equiv 12

Both give K=12K = 12. (Using a=2a=2 the shared key is 2XAXB=230≡26=122^{X_A X_B} = 2^{30} \equiv 2^{6} = 12.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

Show the encryption of plain text “ALGORITHM” using the key “PSEUDOCODE” using playfair cipher.

Answer

Playfair cipher: plaintext ALGORITHM, key PSEUDOCODE

Step 1: 5x5 key matrix. Write the key without repeated letters: P S E U D O C A (the second D, O, E are dropped), then the remaining letters of the alphabet in order, with I and J sharing a cell.

Key letters: P, S, E, U, D, O, C. Remaining: A, B, F, G, H, I/J, K, L, M, N, Q, R, T, V, W, X, Y, Z.

PSEUD
OCABF
GHI/JKL
MNQRT
VWXYZ

Step 2: digraphs. Plaintext ALGORITHM has no doubled letters in a pair: AL GO RI TH M. The odd last letter M is padded with X.

AL | GO | RI | TH | MX

Step 3: encrypt each pair.

Rule: same row, take the letter to the right; same column, take the letter below; otherwise take the letter in own row and the column of the other letter (rectangle).

  • AL: A (row 2, col 3), L (row 3, col 5). Rectangle, so A takes col 5 of row 2 = F, L takes col 3 of row 3 = I. Result FI.
  • GO: G (row 3, col 1), O (row 2, col 1). Same column, so move down: G becomes M, O becomes G. Result MG.
  • RI: R (row 4, col 4), I (row 3, col 3). Rectangle: R takes col 3 of row 4 = Q, I takes col 4 of row 3 = K. Result QK.
  • TH: T (row 4, col 5), H (row 3, col 2). Rectangle: T takes col 2 of row 4 = N, H takes col 5 of row 3 = L. Result NL.
  • MX: M (row 4, col 1), X (row 5, col 3). Rectangle: M takes col 3 of row 4 = Q, X takes col 1 of row 5 = V. Result QV.

Ciphertext: FI MG QK NL QV (FIMGQKNLQV).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

Discuss the working mechanism of kerberos protocol.

Answer

Kerberos

Kerberos is a trusted third-party, ticket-based network authentication protocol based on symmetric-key cryptography (Needham-Schroeder). It lets a client prove its identity to many servers over an insecure network without sending the password, and gives single sign-on. Version 4 uses DES; version 5 uses AES and other ciphers.

Entities: Client (C), Authentication Server (AS), Ticket Granting Server (TGS), and the application Server (V). The AS and TGS together form the Key Distribution Center (KDC), which holds the secret keys of all principals.

Working (version 4 style)

  1. C to AS: the client sends its identity IDCID_C, the TGS identity IDtgsID_{tgs} and a timestamp TS1TS_1.
  2. AS to C: the AS looks up the client's key KCK_C (derived from the password) and replies with EKC[ KC,tgs ∥ IDtgs ∥ TS2 ∥ Lifetime2 ∥ Tickettgs ]E_{K_C}[\,K_{C,tgs} \,\|\, ID_{tgs} \,\|\, TS_2 \,\|\, Lifetime_2 \,\|\, Ticket_{tgs}\,] where Tickettgs=EKtgs[KC,tgs ∥ IDC ∥ ADC ∥ IDtgs ∥ TS2 ∥ Lifetime2]Ticket_{tgs} = E_{K_{tgs}}[K_{C,tgs} \,\|\, ID_C \,\|\, AD_C \,\|\, ID_{tgs} \,\|\, TS_2 \,\|\, Lifetime_2]. Only the real user can decrypt this, using the password-derived key, and obtains the session key KC,tgsK_{C,tgs} and the ticket-granting ticket (TGT).
  3. C to TGS: to access server V the client sends IDVID_V, TickettgsTicket_{tgs} and an authenticator EKC,tgs[IDC ∥ ADC ∥ TS3]E_{K_{C,tgs}}[ID_C \,\|\, AD_C \,\|\, TS_3]. The authenticator proves the sender holds the session key and is fresh.
  4. TGS to C: the TGS decrypts the ticket and authenticator, checks them, and returns EKC,tgs[KC,v ∥ IDV ∥ TS4 ∥ Ticketv]E_{K_{C,tgs}}[K_{C,v} \,\|\, ID_V \,\|\, TS_4 \,\|\, Ticket_v], where Ticketv=EKv[KC,v ∥ IDC ∥ ADC ∥ IDV ∥ TS4 ∥ Lifetime4]Ticket_v = E_{K_v}[K_{C,v} \,\|\, ID_C \,\|\, AD_C \,\|\, ID_V \,\|\, TS_4 \,\|\, Lifetime_4].
  5. C to V: the client sends TicketvTicket_v and a new authenticator EKC,v[IDC ∥ ADC ∥ TS5]E_{K_{C,v}}[ID_C \,\|\, AD_C \,\|\, TS_5].
  6. V to C (mutual authentication): the server replies EKC,v[TS5+1]E_{K_{C,v}}[TS_5 + 1], proving it also knows KC,vK_{C,v}.

After step 6, C and V share the session key KC,vK_{C,v} for secure communication.

Advantages: the password never crosses the network; the TGT lets the user authenticate once per session; timestamps and lifetimes resist replay. Limitations: the KDC is a single point of failure and the clocks of all parties must be loosely synchronised.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

What is the use of firewall? How circuit level gateway differs from stateful inspection firewall?

Answer

Use of a firewall

A firewall is a hardware or software barrier placed between a trusted internal network and an untrusted external network (the Internet). All traffic in both directions must pass through it, and only traffic permitted by the local security policy is allowed. Its uses are:

  • To filter incoming and outgoing packets by address, port, protocol or content, blocking unauthorised access and many attacks (port scans, IP spoofing, DoS).
  • To provide a single choke point where security monitoring, logging and auditing are applied.
  • To hide the internal network structure (NAT) and to provide VPN and proxy services.
  • To enforce the organisation's security policy, such as blocking certain services or sites.

Circuit-level gateway versus stateful inspection firewall

BasisCircuit-level gatewayStateful inspection firewall
OSI layerSession layer (between transport and application).Network and transport layers, with some application-layer awareness.
OperationActs as a relay: sets up two TCP connections (client to gateway, gateway to server) and copies bytes between them without examining the data.Examines every packet and keeps a state table of active connections (addresses, ports, sequence numbers, flags).
Decision basisWhether a TCP handshake is valid and the session is allowed; once the circuit is set up, all data is relayed.Whether the packet belongs to a known, legitimate connection state, plus rule sets. Packets with no matching state are dropped.
Payload checkingNone; contents are not inspected.Can check packet header and, in advanced products, parts of the payload.
Security / overheadHides internal hosts, but cannot detect malicious data inside an allowed session. Low overhead.Stronger security, since it detects out-of-state or spoofed packets, but needs more memory and processing.
ExampleSOCKS proxy.Check Point FireWall-1, modern iptables with connection tracking.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

What is intrusion ? Explain any two types of intrusion detection system.

Answer

Intrusion

An intrusion is an unauthorised attempt, successful or not, to access, misuse or damage a system or network, violating its confidentiality, integrity or availability. Examples are password guessing, privilege escalation by a legitimate user, malware infection and exploiting software vulnerabilities. An Intrusion Detection System (IDS) monitors system or network activity, detects such events and raises alerts (an IPS also blocks them).

Types of IDS

1. Network-based IDS (NIDS). Sensors are placed at key points of the network (behind the firewall, on a switch mirror port) and capture and analyse packets passing by.

  • Detects port scans, DoS floods, malformed packets and known attack signatures in traffic.
  • One sensor covers many hosts and is invisible to attackers, so it is easy to deploy.
  • Weaknesses: cannot read encrypted traffic, may drop packets on a fast network, and cannot see what happens inside a host.
  • Example: Snort.

2. Host-based IDS (HIDS). Software installed on an individual host monitors system logs, file integrity (checksums of critical files), system calls, running processes and login activity.

  • Detects local attacks such as unauthorised file changes, rootkits, privilege abuse and attacks that arrive over encrypted channels.
  • Gives detailed information about the affected host.
  • Weaknesses: must be installed and maintained on every host, uses host resources, and is blinded if the host itself is compromised.
  • Example: Tripwire, OSSEC.

(By detection method, an IDS is also classed as signature-based, which matches known attack patterns and is accurate for known attacks but misses new ones, and anomaly-based, which flags deviation from a learned normal profile and can find new attacks but gives more false alarms.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

Find the multiplicative inverse of polynomial {95} using extended euclidean Algorithm.

Answer

Multiplicative inverse of {95} in GF(28)GF(2^8)

{95} is a hexadecimal byte: 0x95=1001 010120x95 = 1001\,0101_2, i.e. the polynomial b(x)=x7+x4+x2+1.b(x) = x^7 + x^4 + x^2 + 1. The field uses the AES irreducible polynomial m(x)=x8+x4+x3+x+1m(x) = x^8 + x^4 + x^3 + x + 1 ({11B}). We find b(x)−1b(x)^{-1} with the extended Euclidean algorithm: ri=ri−2−qi ri−1r_i = r_{i-2} - q_i\, r_{i-1} and ti=ti−2+qi ti−1t_i = t_{i-2} + q_i\, t_{i-1} (addition is XOR), starting with r−1=m(x), t−1=0r_{-1}=m(x),\ t_{-1}=0 and r0=b(x), t0=1r_0=b(x),\ t_0=1.

Divisions

  1. m(x)÷b(x)m(x) \div b(x): quotient q1=xq_1 = x, remainder r1=x8+x4+x3+x+1+x(x7+x4+x2+1)=x5+x4+1r_1 = x^8+x^4+x^3+x+1 + x(x^7+x^4+x^2+1) = x^5+x^4+1 (since x b(x)=x8+x5+x3+xx\,b(x) = x^8+x^5+x^3+x). t1=0+x⋅1=xt_1 = 0 + x\cdot 1 = x.
  2. b(x)÷r1b(x) \div r_1: quotient q2=x2+x+1q_2 = x^2+x+1, remainder r2=xr_2 = x. Check: (x2+x+1)(x5+x4+1)=x7+x6+x2+x6+x5+x+x5+x4+1=x7+x4+x2+x+1(x^2+x+1)(x^5+x^4+1) = x^7+x^6+x^2 + x^6+x^5+x + x^5+x^4+1 = x^7+x^4+x^2+x+1; added to b(x)b(x) gives xx. t2=1+(x2+x+1) x=x3+x2+x+1t_2 = 1 + (x^2+x+1)\,x = x^3+x^2+x+1.
  3. r1÷r2r_1 \div r_2: (x5+x4+1)÷x(x^5+x^4+1) \div x gives quotient q3=x4+x3q_3 = x^4+x^3, remainder r3=1r_3 = 1. t3=t1+q3t2=x+(x4+x3)(x3+x2+x+1)t_3 = t_1 + q_3 t_2 = x + (x^4+x^3)(x^3+x^2+x+1) =x+(x7+x6+x5+x4+x6+x5+x4+x3)=x+x7+x3.= x + (x^7+x^6+x^5+x^4 + x^6+x^5+x^4+x^3) = x + x^7 + x^3.

The remainder is 1, so gcd⁡=1\gcd = 1 and the inverse is t3t_3:

b(x)−1=x7+x3+x=1000 10102={8A}.b(x)^{-1} = x^7 + x^3 + x = 1000\,1010_2 = \{8A\}.

Verification: b(x)⋅(x7+x3+x) mod m(x)b(x)\cdot(x^7+x^3+x) \bmod m(x):

(x7+x4+x2+1)(x7+x3+x)=x14+x10+x8+x11+x7+x5+x9+x5+x3+x7+x3+x(x^7+x^4+x^2+1)(x^7+x^3+x) = x^{14}+x^{10}+x^8+x^{11}+x^7+x^5+x^9+x^5+x^3+x^7+x^3+x =x14+x11+x10+x9+x8+x= x^{14}+x^{11}+x^{10}+x^9+x^8+x (the x7,x5,x3x^7, x^5, x^3 terms cancel in pairs).

Reducing with x8≡x4+x3+x+1x^8 \equiv x^4+x^3+x+1: x9≡x5+x4+x2+xx^9 \equiv x^5+x^4+x^2+x, x10≡x6+x5+x3+x2x^{10}\equiv x^6+x^5+x^3+x^2, x11≡x7+x6+x4+x3x^{11}\equiv x^7+x^6+x^4+x^3, x14≡x10⋅x4x^{14} \equiv x^{10}\cdot x^4; x12≡x8+x7+x5+x4≡x7+x5+x3+x+1x^{12}\equiv x^8+x^7+x^5+x^4 \equiv x^7+x^5+x^3+x+1, x13≡x8+x6+x4+x2+x≡x6+x3+x2+1x^{13}\equiv x^8+x^6+x^4+x^2+x \equiv x^6+x^3+x^2+1, x14≡x7+x4+x3+xx^{14}\equiv x^7+x^4+x^3+x. Sum: (x7+x4+x3+x)+(x7+x6+x4+x3)+(x6+x5+x3+x2)+(x5+x4+x2+x)+(x4+x3+x+1)+x=1.(x^7+x^4+x^3+x)+(x^7+x^6+x^4+x^3)+(x^6+x^5+x^3+x^2)+(x^5+x^4+x^2+x)+(x^4+x^3+x+1)+x = 1. Hence the product is 1.

Answer: {95}−1^{-1} = {8A}.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

What is DoS attack ? Discuss about PKI trust model.

Answer

DoS attack

A Denial of Service (DoS) attack is an attempt to make a computer, service or network unavailable to its legitimate users by exhausting its resources (bandwidth, CPU, memory, connection table) or by crashing it with malformed input. When the attack is launched from many compromised machines (a botnet) at once, it is a Distributed DoS (DDoS). It attacks the availability goal of security.

Common forms:

  • SYN flood: many TCP SYN packets with spoofed source addresses fill the server's half-open connection queue.
  • ICMP/ping flood and smurf attack: flooding the target with ICMP echo traffic, directly or through broadcast amplification.
  • UDP flood and DNS/NTP amplification: small spoofed requests produce large replies sent to the victim.
  • Ping of death / teardrop: malformed or oversized packets crash the protocol stack.

Countermeasures are ingress/egress filtering, SYN cookies, rate limiting, firewalls/IPS, and traffic scrubbing or CDN services.

PKI trust models

A Public Key Infrastructure (PKI) binds public keys to identities through certificates signed by Certification Authorities (CAs). A trust model defines how a user decides to trust a certificate issued by a CA he does not know directly.

  1. Hierarchical (rooted) model. CAs form a tree. A single root CA, trusted by everyone, certifies subordinate CAs, which certify lower CAs and end users. A certificate is validated by following the chain up to the root. Used in the web (X.509 root stores). Simple, but compromise of the root breaks everything.
  2. Bridge (cross-certification / mesh) model. Independent CAs or hierarchies issue certificates to each other, often through a bridge CA, so that users of different PKIs can validate each other. Flexible, but path discovery is more complex.
  3. Web of trust (PGP). There are no CAs. Each user signs the keys of people he knows personally and decides how much to trust other signers. A key is trusted if enough trusted people have signed it. Decentralised, but hard to scale.
  4. Single-CA / trust list models. One CA for a closed organisation, or a browser-style list of trusted CAs.

In every model the certificate path is checked for valid signatures, validity period and revocation status (CRL or OCSP).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

Using Vignere cipher with key = “worlds”, encrypt the plain text “hello everyone”.

Answer

Vigenere cipher: key "worlds", plaintext "hello everyone"

Encryption: Ci=(Pi+Ki) mod 26C_i = (P_i + K_i) \bmod 26, with A=0, B=1, ..., Z=25. Spaces are ignored. The plaintext letters are HELLOEVERYONE (13 letters). The key repeats: W O R L D S W O R L D S W (values 22, 14, 17, 11, 3, 18, 22, 14, 17, 11, 3, 18, 22).

PlainHELLOEVERYONE
PP741111144214172414134
KeyWORLDSWORLDSW
KK221417113182214171131822
P+KP+K29182822172243183435173126
mod 2631822217221718891750
CipherDSCWRWRSIJRFA

Ciphertext: DSCWRWRSIJRFA (DSCWR WRSIJRFA when grouped like the plaintext).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

Describe the different modes of block cipher.

Answer

Modes of block cipher operation

A block cipher encrypts fixed-size blocks (64 bits for DES, 128 bits for AES). To encrypt longer messages securely, NIST defines modes of operation. Let PiP_i be plaintext blocks, CiC_i ciphertext blocks and EKE_K the block encryption.

1. Electronic Codebook (ECB). Each block is encrypted independently: Ci=EK(Pi),Pi=DK(Ci).C_i = E_K(P_i), \qquad P_i = D_K(C_i). Simple and parallelisable, and errors do not propagate. But identical plaintext blocks give identical ciphertext blocks, so patterns leak; it is suitable only for short data such as keys.

2. Cipher Block Chaining (CBC). Each plaintext block is XORed with the previous ciphertext block before encryption: Ci=EK(Pi⊕Ci−1),C0=IV,Pi=DK(Ci)⊕Ci−1.C_i = E_K(P_i \oplus C_{i-1}), \quad C_0 = IV, \qquad P_i = D_K(C_i) \oplus C_{i-1}. Identical plaintext blocks give different ciphertext. Encryption is sequential; an error in a ciphertext block garbles that block and flips a bit in the next one. A random IV is needed.

3. Cipher Feedback (CFB). The block cipher is used as a stream cipher on ss-bit segments. The shift register (initially the IV) is encrypted and its leftmost ss bits are XORed with the plaintext segment: Ci=Pi⊕MSBs(EK(Xi)),Xi+1=(Xi≪s) ∣ Ci.C_i = P_i \oplus \text{MSB}_s(E_K(X_i)), \qquad X_{i+1} = (X_i \ll s) \,|\, C_i. Self-synchronising; only the encryption function is used (for both directions). An error affects the next block-size worth of data.

4. Output Feedback (OFB). Like CFB, but the feedback is the cipher output and not the ciphertext: Oi=EK(Oi−1), O0=IV,Ci=Pi⊕Oi.O_i = E_K(O_{i-1}),\ O_0 = IV, \qquad C_i = P_i \oplus O_i. The keystream does not depend on the plaintext and can be precomputed; a bit error in ciphertext causes only a single bit error in the plaintext. The IV must never be reused with the same key.

5. Counter (CTR). A counter (nonce plus a block number) is encrypted and XORed with plaintext: Ci=Pi⊕EK(Counteri).C_i = P_i \oplus E_K(\text{Counter}_i). Fully parallel in both encryption and decryption, with random access to any block, and no padding required.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

Write short notes on (any two)
  1. Totient value of any positive integer.
  2. Properties of hash function.
  3. Virus or Worms.

Answer

1. Totient value of a positive integer

Euler's totient function ϕ(n)\phi(n) is the number of positive integers less than nn that are relatively prime to nn (that is, gcd⁡(k,n)=1\gcd(k, n) = 1, 1≤k<n1 \le k < n), with ϕ(1)=1\phi(1) = 1.

Properties:

  • If pp is prime, ϕ(p)=p−1\phi(p) = p - 1.
  • For a prime power, ϕ(pk)=pk−pk−1=pk(1−1p)\phi(p^k) = p^k - p^{k-1} = p^k\left(1 - \tfrac{1}{p}\right).
  • It is multiplicative: if gcd⁡(m,n)=1\gcd(m, n) = 1 then ϕ(mn)=ϕ(m) ϕ(n)\phi(mn) = \phi(m)\,\phi(n). Hence for n=p1a1⋯pkakn = p_1^{a_1}\cdots p_k^{a_k}, ϕ(n)=n∏i(1−1pi).\phi(n) = n\prod_{i}\left(1 - \frac{1}{p_i}\right).
  • In particular, for primes p≠qp \ne q: ϕ(pq)=(p−1)(q−1)\phi(pq) = (p-1)(q-1).

Example: ϕ(12)\phi(12): the numbers coprime to 12 below 12 are 1, 5, 7, 11, so ϕ(12)=4\phi(12) = 4. By the formula, 12(1−12)(1−13)=412(1 - \tfrac12)(1 - \tfrac13) = 4.

Euler's theorem: aϕ(n)≡1(modn)a^{\phi(n)} \equiv 1 \pmod n for gcd⁡(a,n)=1\gcd(a, n) = 1. This is the basis of RSA, where ϕ(n)=(p−1)(q−1)\phi(n) = (p-1)(q-1) is used to compute the private key d=e−1 mod ϕ(n)d = e^{-1} \bmod \phi(n).

2. Properties of a hash function

A hash function HH maps a message of arbitrary length to a fixed-length digest h=H(M)h = H(M). A cryptographic hash function should satisfy:

  1. Variable input size: HH can be applied to a block of any size.
  2. Fixed output size: it produces a fixed-length output.
  3. Efficiency: H(x)H(x) is easy to compute for any xx.
  4. Preimage resistance (one-way): given hh, it is computationally infeasible to find xx with H(x)=hH(x) = h.
  5. Second-preimage resistance (weak collision resistance): given xx, it is infeasible to find y≠xy \ne x with H(y)=H(x)H(y) = H(x).
  6. Collision resistance (strong): it is infeasible to find any pair x≠yx \ne y with H(x)=H(y)H(x) = H(y).
  7. Avalanche effect / pseudorandomness: a one-bit change in the input changes about half the output bits.

Uses: message integrity, digital signatures, password storage and MACs (HMAC).

3. Virus and worms

A virus is malicious code that attaches itself to a host program or file and replicates when the infected program is executed by the user. Its phases are dormant, propagation, triggering and execution. Types are parasitic, boot-sector, memory-resident, macro and polymorphic/metamorphic viruses. It needs human action (running the host file) to spread.

A worm is a standalone self-replicating program that spreads by itself over networks, exploiting vulnerabilities in services, e-mail or shared drives, without needing a host program or user action. It searches for new targets, transfers a copy and executes it there. Examples: Morris worm (1988), Code Red, Slammer. Worms mainly consume bandwidth and resources and may carry a payload such as a backdoor.

VirusWorm
Host programNeededNot needed
SpreadBy user running infected fileAutomatically via network
SpeedSlowerVery fast

Defence: antivirus software, patching, firewalls and user awareness.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 10 marks

Describe the Fiestel 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.
0123456789ABCDEF
0637C777BF26B6FC53001672BFED7AB76

Answer

Feistel cipher structure

The Feistel structure (used in DES, Blowfish, Camellia) builds a strong block cipher from a repeated simple round. It was proposed by Horst Feistel, following Shannon's ideas of confusion (substitution) and diffusion (permutation).

  • The plaintext block of 2w2w bits is split into a left half L0L_0 and a right half R0R_0.
  • There are nn rounds. In round ii a subkey KiK_i, derived from the main key by a key schedule, is used.
  • Each round performs: Li=Ri−1,Ri=Li−1⊕F(Ri−1,Ki)L_i = R_{i-1}, \qquad R_i = L_{i-1} \oplus F(R_{i-1}, K_i) where FF is the round function (substitution and permutation, not necessarily invertible).
  • After the last round the halves are swapped, giving the ciphertext (Rn,Ln)(R_n, L_n).
  • Decryption uses the same structure with the subkeys in reverse order Kn,…,K1K_n, \dots, K_1. Because Li−1=Ri⊕F(Li,Ki)L_{i-1} = R_i \oplus F(L_i, K_i), FF never needs to be inverted.

Design parameters: block size, key size, number of rounds, subkey generation and the round function FF. Larger sizes give more security but lower speed.

First four bytes of the next key (AES key expansion, first iteration)

The 128-bit key is 16 bytes, divided into four words:

w0={2B,7E,15,16}w_0 = \{2B, 7E, 15, 16\}, w1={28,AE,D2,A6}w_1 = \{28, AE, D2, A6\}, w2={AB,F7,97,66}w_2 = \{AB, F7, 97, 66\}, w3={01,02,03,04}w_3 = \{01, 02, 03, 04\}.

The next round key starts with w4=w0⊕g(w3)w_4 = w_0 \oplus g(w_3), where gg does three things.

  1. RotWord on w3w_3 (one-byte left rotation): {01,02,03,04}→{02,03,04,01}\{01, 02, 03, 04\} \to \{02, 03, 04, 01\}.
  2. SubWord with the S-box (row = high nibble 0, column = low nibble):
  • 02 gives 77
  • 03 gives 7B
  • 04 gives F2
  • 01 gives 7C

Result {77,7B,F2,7C}\{77, 7B, F2, 7C\}. 3. XOR with the round constant Rcon[1]={01,00,00,00}Rcon[1] = \{01, 00, 00, 00\}: 77⊕01=7677 \oplus 01 = 76. Result g(w3)={76,7B,F2,7C}g(w_3) = \{76, 7B, F2, 7C\}.

Now w4=w0⊕g(w3)w_4 = w_0 \oplus g(w_3):

Bytew0w_0g(w3)g(w_3)XOR
12B = 0010 101176 = 0111 01100101 1101 = 5D
27E = 0111 11107B = 0111 10110000 0101 = 05
315 = 0001 0101F2 = 1111 00101110 0111 = E7
416 = 0001 01107C = 0111 11000110 1010 = 6A

The first four bytes of the next key are {5D, 05, E7, 6A}.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 10 marks

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.

Answer

Man-in-the-middle attack on Diffie-Hellman

Diffie-Hellman key exchange does not authenticate the parties, so an active attacker Darth who can intercept and modify messages can set up separate keys with each of them.

Public parameters: prime q=19q = 19 and primitive root α=10\alpha = 10.

  1. Alice chooses private XA=5X_A = 5 and computes YA=105 mod 19=3Y_A = 10^5 \bmod 19 = 3. Bob chooses XB=7X_B = 7 and computes YB=107 mod 19=15Y_B = 10^7 \bmod 19 = 15.
  2. Darth generates his own private value XD=4X_D = 4 and YD=104 mod 19=6Y_D = 10^4 \bmod 19 = 6.
  3. Alice sends YA=3Y_A = 3; Darth intercepts it and sends YD=6Y_D = 6 to Bob. Bob sends YB=15Y_B = 15; Darth intercepts it and sends YD=6Y_D = 6 to Alice.
  4. Alice computes K1=YDXA=65 mod 19=5K_1 = Y_D^{X_A} = 6^5 \bmod 19 = 5. Darth computes the same value K1=YAXD=34 mod 19=5K_1 = Y_A^{X_D} = 3^4 \bmod 19 = 5.
  5. Bob computes K2=YDXB=67 mod 19=9K_2 = Y_D^{X_B} = 6^7 \bmod 19 = 9. Darth computes K2=YBXD=154 mod 19=9K_2 = Y_B^{X_D} = 15^4 \bmod 19 = 9.

Alice now shares key 5 with Darth and Bob shares key 9 with Darth, while each believes they share a key with each other. Darth decrypts every message from Alice with K1K_1, reads or alters it, re-encrypts it with K2K_2 and forwards it to Bob (and vice versa). Neither party notices. Prevention: authenticate the exchanged values with digital signatures or certificates (station-to-station protocol).

ElGamal encryption

Given q=19q = 19, α=10\alpha = 10, private key X=5X = 5, random integer k=4k = 4, message M=2M = 2.

Public key: Y=αX mod q=105 mod 19=3Y = \alpha^{X} \bmod q = 10^5 \bmod 19 = 3. (102=100≡510^2 = 100 \equiv 5, 104≡25≡610^4 \equiv 25 \equiv 6, 105≡60≡310^5 \equiv 60 \equiv 3.)

One-time key: K=Yk mod q=34 mod 19=81 mod 19=5K = Y^{k} \bmod q = 3^4 \bmod 19 = 81 \bmod 19 = 5.

Ciphertext:

C1=αk mod q=104 mod 19=6C_1 = \alpha^{k} \bmod q = 10^4 \bmod 19 = 6 C2=K⋅M mod q=5×2 mod 19=10C_2 = K \cdot M \bmod q = 5 \times 2 \bmod 19 = 10

The ciphertext is (C1,C2)=(6,10)(C_1, C_2) = (6, 10).

Check by decryption: K=C1X=65 mod 19=7776 mod 19=5K = C_1^{X} = 6^5 \bmod 19 = 7776 \bmod 19 = 5 (as 19×409=777119 \times 409 = 7771). K−1=4K^{-1} = 4 since 5×4=20≡15 \times 4 = 20 \equiv 1. M=C2K−1=10×4=40≡2M = C_2 K^{-1} = 10 \times 4 = 40 \equiv 2. Correct.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 10 marks

List the properties of hash function. Describe the algorithm for SHA-1.

Answer

Properties of a hash function

A hash function HH maps a message of any length to a fixed-length digest. For cryptographic use it should have:

  1. Variable-length input and fixed-length output.
  2. Efficient computation of H(x)H(x) for any xx in hardware and software.
  3. Preimage resistance (one-way): given hh, infeasible to find xx with H(x)=hH(x) = h.
  4. Second-preimage resistance: given xx, infeasible to find y≠xy \ne x with H(y)=H(x)H(y) = H(x).
  5. Collision resistance: infeasible to find any x≠yx \ne y with H(x)=H(y)H(x) = H(y).
  6. Avalanche effect: a small change in the input changes the digest unpredictably.

SHA-1 algorithm

SHA-1 (Secure Hash Algorithm, NIST 1995) takes a message of length less than 2642^{64} bits, processes it in 512-bit blocks and produces a 160-bit digest.

Step 1: Padding. Append a single bit 1, then 0 bits until the length is 448 mod 512448 \bmod 512. The padding is always added, even if the message already has that length.

Step 2: Append length. Append the original message length as a 64-bit big-endian integer. The message is now a multiple of 512 bits.

Step 3: Initialise the buffer. Five 32-bit registers A,B,C,D,EA, B, C, D, E (the hash state H0…H4H_0 \dots H_4) are set to

  • H0H_0 = 67452301
  • H1H_1 = EFCDAB89
  • H2H_2 = 98BADCFE
  • H3H_3 = 10325476
  • H4H_4 = C3D2E1F0

Step 4: Process each 512-bit block.

(a) Divide the block into sixteen 32-bit words W0…W15W_0 \dots W_{15} and expand to 80 words: Wt=ROTL1(Wt−3⊕Wt−8⊕Wt−14⊕Wt−16),16≤t≤79.W_t = \text{ROTL}^1(W_{t-3} \oplus W_{t-8} \oplus W_{t-14} \oplus W_{t-16}), \quad 16 \le t \le 79.

(b) Set A,B,C,D,EA, B, C, D, E to the current H0…H4H_0 \dots H_4.

(c) Run 80 steps (t=0…79t = 0 \dots 79), in four rounds of 20 steps: T=ROTL5(A)+ft(B,C,D)+E+Wt+Kt(mod232)T = \text{ROTL}^5(A) + f_t(B, C, D) + E + W_t + K_t \pmod{2^{32}} E=D; D=C; C=ROTL30(B); B=A; A=T.E = D;\ D = C;\ C = \text{ROTL}^{30}(B);\ B = A;\ A = T.

Stepsft(B,C,D)f_t(B,C,D)KtK_t
0 to 19(B∧C)∨(¬B∧D)(B \wedge C) \vee (\neg B \wedge D)5A827999
20 to 39B⊕C⊕DB \oplus C \oplus D6ED9EBA1
40 to 59(B∧C)∨(B∧D)∨(C∧D)(B \wedge C) \vee (B \wedge D) \vee (C \wedge D)8F1BBCDC
60 to 79B⊕C⊕DB \oplus C \oplus DCA62C1D6

(d) Add the result to the chaining value (mod 2322^{32}): H0+=A, H1+=B, H2+=C, H3+=D, H4+=EH_0 \mathrel{+}= A,\ H_1 \mathrel{+}= B,\ H_2 \mathrel{+}= C,\ H_3 \mathrel{+}= D,\ H_4 \mathrel{+}= E.

Step 5: Output. After the last block, the digest is the concatenation H0∥H1∥H2∥H3∥H4H_0 \| H_1 \| H_2 \| H_3 \| H_4 (160 bits).

SHA-1 is no longer considered collision-resistant (a practical collision was shown in 2017), so SHA-2 or SHA-3 is preferred.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 5 marks

Describe any three types of malicious logic.

Answer

Malicious logic

Malicious logic (malware) is any program or code inserted into a system to harm its confidentiality, integrity or availability. Three common types follow.

1. Virus. A piece of code that attaches itself to an executable file, boot sector or document macro and spreads when the infected host is run or opened. It passes through dormant, propagation, triggering and execution phases. It copies itself into other files and may delete data, corrupt files or display messages. It needs user action to spread. Variants are parasitic, memory-resident, boot-sector, macro, polymorphic and metamorphic viruses.

2. Worm. A self-contained program that replicates and spreads across networks on its own, using vulnerabilities in network services, e-mail or removable media. It needs no host file and no user action. It causes network congestion and can install backdoors or carry a payload. Examples: Morris worm, Code Red, Blaster.

3. Trojan horse. A program that appears useful or harmless (a game, utility, cracked software) but carries a hidden harmful function, such as stealing passwords, opening a backdoor or deleting files. It does not replicate by itself; users install it voluntarily.

Other types are logic bomb (code that triggers on a condition such as a date or a deleted employee record), backdoor/trapdoor (secret entry point bypassing authentication), spyware, ransomware, rootkit and botnet agents.

Countermeasures: antivirus and anti-malware, regular patching, firewalls, least privilege, backups and safe user behaviour.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 5 marks

Given the key “HELLOWORLD”, encrypt the plaintext “TURINGTEST” using Play fair cipher.

Answer

Playfair cipher: key HELLOWORLD, plaintext TURINGTEST

Step 1: Key matrix. Remove repeated letters from HELLOWORLD to get H E L O W R D. Then add the remaining alphabet letters in order (I and J share a cell).

HELOW
RDABC
FGI/JKM
NPQST
UVXYZ

Step 2: Digraphs. TURINGTEST has no repeated letters inside a pair: TU RI NG TE ST (10 letters, 5 pairs).

Step 3: Encryption. (Same row: take the letter on the right; same column: take the letter below; otherwise swap columns.)

  • TU: T (row 4, col 5), U (row 5, col 1). Rectangle: T takes col 1 of row 4 = N, U takes col 5 of row 5 = Z. Result NZ.
  • RI: R (row 2, col 1), I (row 3, col 3). Rectangle: R takes col 3 of row 2 = A, I takes col 1 of row 3 = F. Result AF.
  • NG: N (row 4, col 1), G (row 3, col 2). Rectangle: N takes col 2 of row 4 = P, G takes col 1 of row 3 = F. Result PF.
  • TE: T (row 4, col 5), E (row 1, col 2). Rectangle: T takes col 2 of row 4 = P, E takes col 5 of row 1 = W. Result PW.
  • ST: S (row 4, col 4), T (row 4, col 5). Same row: S becomes the letter to the right, T; T wraps around to N. Result TN.

Ciphertext: NZ AF PF PW TN (NZAFPFPWTN).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 5 marks

Explain any two modes of block cipher encryption.

Answer

Modes of block cipher encryption

A block cipher encrypts only a fixed-size block (64 bits for DES, 128 for AES), so a mode of operation is used to encrypt messages of arbitrary length. Two important modes are explained here (PiP_i plaintext block, CiC_i ciphertext block, EKE_K the block cipher with key KK).

1. Electronic Codebook (ECB)

Each plaintext block is encrypted separately with the same key: Ci=EK(Pi),Pi=DK(Ci).C_i = E_K(P_i), \qquad P_i = D_K(C_i).

  • Blocks can be processed in parallel and an error in one block does not affect others.
  • Identical plaintext blocks give identical ciphertext blocks, so patterns in the data are visible. It is therefore unsuitable for long or structured messages and is used only for short data such as key transport.

2. Cipher Block Chaining (CBC)

Each plaintext block is XORed with the previous ciphertext block before it is encrypted. The first block uses a random initialisation vector (IV): C1=EK(P1⊕IV),Ci=EK(Pi⊕Ci−1).C_1 = E_K(P_1 \oplus IV), \qquad C_i = E_K(P_i \oplus C_{i-1}). Pi=DK(Ci)⊕Ci−1.P_i = D_K(C_i) \oplus C_{i-1}.

  • The same plaintext blocks produce different ciphertext, so patterns are hidden.
  • Encryption is sequential (not parallel); decryption can be parallel.
  • A bit error in CiC_i garbles PiP_i and flips the corresponding bit in Pi+1P_{i+1} only.
  • The IV need not be secret but should be unpredictable and is sent with the ciphertext.
  • It is used for general data encryption and for CBC-MAC authentication.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 5 marks

State Fermat’s theorem with example. What is the implication of discrete logarithm?

Answer

Fermat's theorem

If pp is a prime and aa is an integer not divisible by pp, then ap−1≡1(modp).a^{p-1} \equiv 1 \pmod p. An equivalent form, valid for every integer aa, is ap≡a(modp)a^p \equiv a \pmod p.

Example 1: p=11p = 11, a=2a = 2: 210=1024=93×11+12^{10} = 1024 = 93 \times 11 + 1, so 210≡1(mod11)2^{10} \equiv 1 \pmod{11}.

Example 2 (use in computation): find 3100 mod 73^{100} \bmod 7. Since 36≡1(mod7)3^6 \equiv 1 \pmod 7, 3100=(36)16⋅34≡34=81≡4(mod7)3^{100} = (3^6)^{16} \cdot 3^4 \equiv 3^4 = 81 \equiv 4 \pmod 7.

Fermat's theorem is used for primality testing (Fermat and Miller-Rabin tests), for finding inverses (a−1≡ap−2 mod pa^{-1} \equiv a^{p-2} \bmod p), and is a special case of Euler's theorem, which underlies RSA.

Implication of the discrete logarithm

By Fermat, the powers of a primitive root aa of pp cycle through 1…p−11 \dots p-1 with period p−1p-1. For y=ax mod py = a^x \bmod p the unique xx (0≤x≤p−20 \le x \le p-2) is the discrete logarithm dlog⁡a,p(y)\operatorname{dlog}_{a,p}(y).

  • Computing yy from xx is fast (square-and-multiply), but finding xx from yy is computationally infeasible for a large prime (no polynomial-time algorithm is known; the best known methods are sub-exponential).
  • This one-way property is the foundation of the security of Diffie-Hellman key exchange, ElGamal encryption, DSA and elliptic-curve cryptography. An attacker who sees the public values cannot recover the private exponents.
  • The consequence for design is that pp must be large (at least 2048 bits for classical groups) and aa a primitive root, otherwise the group is small and the logarithm is easy to find. A quantum computer running Shor's algorithm could solve it efficiently, which motivates post-quantum cryptography.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 5 marks

Describe the working mechanism of digital signature algorithm.

Answer

Digital Signature Algorithm (DSA)

DSA is the NIST Digital Signature Standard (FIPS 186). It provides authentication, integrity and non-repudiation, but not encryption. Its security rests on the discrete logarithm problem. It uses SHA to hash the message.

Global public parameters

  • pp: a large prime of 512 to 3072 bits (LL bits).
  • qq: a prime divisor of p−1p-1 of 160 to 256 bits (NN bits).
  • g=h(p−1)/q mod pg = h^{(p-1)/q} \bmod p, where 1<h<p−11 < h < p-1 and g>1g > 1. Then gg has order qq mod pp.

Keys

  • Private key: a random integer xx with 0<x<q0 < x < q.
  • Public key: y=gx mod py = g^{x} \bmod p.

Signing a message MM

  1. Choose a random per-message secret kk, 0<k<q0 < k < q.
  2. Compute r=(gk mod p) mod qr = (g^{k} \bmod p) \bmod q.
  3. Compute s=[k−1 (H(M)+x r)] mod qs = \left[k^{-1}\,(H(M) + x\,r)\right] \bmod q.
  4. The signature is the pair (r,s)(r, s). If r=0r = 0 or s=0s = 0, choose a new kk.

Verifying (r,s)(r, s) on a received M′M'

  1. Check 0<r<q0 < r < q and 0<s<q0 < s < q.
  2. Compute w=s−1 mod qw = s^{-1} \bmod q.
  3. u1=[H(M′) w] mod qu_1 = [H(M')\,w] \bmod q and u2=(r w) mod qu_2 = (r\,w) \bmod q.
  4. v=[(gu1 yu2) mod p] mod qv = \left[(g^{u_1}\, y^{u_2}) \bmod p\right] \bmod q.
  5. The signature is valid if v=rv = r.

Why it works: s−1≡k (H+xr)−1s^{-1} \equiv k\,(H + xr)^{-1}, so u1+xu2≡w(H+xr)≡k(modq)u_1 + x u_2 \equiv w(H + xr) \equiv k \pmod q. Hence gu1yu2≡gk(modp)g^{u_1}y^{u_2} \equiv g^{k} \pmod p, and v=rv = r.

The value kk must be secret, random and never reused; otherwise the private key xx can be recovered.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 5 marks

List and explain the types of firewall.

Answer

Types of firewall

A firewall controls traffic between a trusted and an untrusted network according to a security policy. The main types are the following.

1. Packet-filtering firewall (network layer). Examines each packet separately against rules based on source and destination IP, port, protocol and flags (ACLs), and permits or drops it. It is fast and cheap and transparent to users. But it knows nothing of connection state or application data, and is weak against IP spoofing and fragmentation attacks.

2. Stateful inspection firewall (network and transport layers). Keeps a table of active connections (addresses, ports, TCP state and sequence numbers) and allows a packet only if it belongs to a valid, established connection or matches a rule for a new one. It provides better security than simple packet filtering at moderate cost.

3. Circuit-level gateway (session layer). Acts as a relay between two TCP connections, checking the TCP handshake and session validity, then passing data without looking at its content. It hides the internal network but cannot detect malicious content within allowed sessions. Example: SOCKS.

4. Application-level gateway / proxy firewall (application layer). For each service (HTTP, FTP, SMTP) a proxy accepts the client's request, examines the application data and makes a new request to the server on the client's behalf. It gives the finest control (content filtering, user authentication, logging) and complete hiding of internal hosts, but is slow and needs a proxy for each application.

5. Next-generation firewall (NGFW). Combines stateful inspection with deep packet inspection, intrusion prevention, application awareness and user identity.

By implementation firewalls are also classed as host-based (software on one machine, personal firewall) and network-based (dedicated device or appliance at the perimeter). Common configurations are the bastion host, screened host and screened subnet (DMZ).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 5 marks

Decrypt the ciphertext “HI” using Hill Cipher where the key is [5/4 3/3].

Answer

Hill cipher decryption of "HI" with key K=(5433)K = \begin{pmatrix}5 & 4\\ 3 & 3\end{pmatrix}

Decryption: P=K−1C mod 26P = K^{-1} C \bmod 26.

Ciphertext vector. H = 7, I = 8, so C=(78)C = \begin{pmatrix}7\\ 8\end{pmatrix}.

Determinant. det⁡K=5⋅3−4⋅3=3\det K = 5\cdot 3 - 4\cdot 3 = 3. Since gcd⁡(3,26)=1\gcd(3, 26) = 1, the key is invertible. The inverse of 3 mod 26 is 9, because 3×9=27≡13 \times 9 = 27 \equiv 1.

Inverse matrix.

K−1=9(3−4−35)=(27−36−2745)≡(1162519)(mod26)K^{-1} = 9\begin{pmatrix}3 & -4\\ -3 & 5\end{pmatrix} = \begin{pmatrix}27 & -36\\ -27 & 45\end{pmatrix} \equiv \begin{pmatrix}1 & 16\\ 25 & 19\end{pmatrix} \pmod{26}

Check: KK−1K K^{-1} first row: 5⋅1+4⋅25=105=4⋅26+1≡15\cdot1 + 4\cdot25 = 105 = 4\cdot26+1 \equiv 1; 5⋅16+4⋅19=156=6⋅26≡05\cdot16 + 4\cdot19 = 156 = 6\cdot26 \equiv 0. Second row: 3⋅1+3⋅25=78≡03\cdot1+3\cdot25 = 78 \equiv 0; 3⋅16+3⋅19=105≡13\cdot16+3\cdot19 = 105 \equiv 1. So KK−1=IK K^{-1} = I.

Plaintext.

P=(1162519)(78)=(7+128175+152)=(135327)≡(515)(mod26)P = \begin{pmatrix}1 & 16\\ 25 & 19\end{pmatrix}\begin{pmatrix}7\\ 8\end{pmatrix} = \begin{pmatrix}7 + 128\\ 175 + 152\end{pmatrix} = \begin{pmatrix}135\\ 327\end{pmatrix} \equiv \begin{pmatrix}5\\ 15\end{pmatrix} \pmod{26}

(135=5⋅26+5135 = 5\cdot26 + 5; 327=12⋅26+15327 = 12\cdot26 + 15.)

The numbers 5 and 15 correspond to F and P.

Plaintext: "FP".

Check by encryption: KP=(5⋅5+4⋅153⋅5+3⋅15)=(8560)≡(78)K P = \begin{pmatrix}5\cdot5 + 4\cdot15\\ 3\cdot5 + 3\cdot15\end{pmatrix} = \begin{pmatrix}85\\ 60\end{pmatrix} \equiv \begin{pmatrix}7\\ 8\end{pmatrix} = HI.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 5 marks

What is digital certificate? Discuss the certificate life cycle.

Answer

Digital certificate

A digital certificate is an electronic document that binds a public key to the identity of its owner (a person, server or organisation). It is issued and digitally signed by a trusted Certification Authority (CA), so anyone who trusts the CA can trust that the public key belongs to the named subject. The common format is X.509, which contains: version, serial number, signature algorithm, issuer name, validity period (not before / not after), subject name, subject public key, extensions, and the CA's digital signature.

Certificate life cycle

  1. Key generation and request. The subject generates a key pair and sends a Certificate Signing Request (CSR) with the public key and identity details to the Registration Authority (RA).
  2. Registration and verification. The RA/CA verifies the identity of the applicant (domain control, documents).
  3. Issuance. The CA signs the certificate with its private key and delivers it. It is published in a repository or directory.
  4. Use / validation. Relying parties check the CA signature, the validity period, the intended use and that the certificate has not been revoked, using a CRL (Certificate Revocation List) or OCSP.
  5. Renewal / re-key. Before expiry the subject obtains a new certificate with the same or a new key pair.
  6. Revocation. If the private key is compromised, details change or the certificate is misused, the CA revokes it before expiry and lists it in the CRL.
  7. Expiry / destruction. After its validity ends, the certificate is no longer valid; keys are archived or securely destroyed.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2082 · 5 marks

Define authentication system. Discuss about challenge response system.

Answer

Authentication system

Authentication is the process of verifying that a user, device or process is who it claims to be before access is granted. An authentication system implements this verification, normally using one or more factors:

  • Something you know: password, PIN.
  • Something you have: smart card, token, mobile phone.
  • Something you are: fingerprint, iris, face (biometrics).

Using two or more factors gives multi-factor authentication. The system includes the credential store, the verification protocol and the access decision (for example, passwords, Kerberos, or certificate-based authentication).

Challenge-response system

In a challenge-response scheme the secret is never sent. Instead the verifier sends a challenge and the user proves knowledge of the secret by computing a response from it.

Working:

  1. The client sends its identity to the server.
  2. The server sends a fresh, unpredictable challenge RR (a random nonce).
  3. The client computes the response using the shared secret: Response=f(secret,R)\text{Response} = f(\text{secret}, R), for example H(password∥R)H(\text{password} \| R), HMACK(R)\text{HMAC}_K(R), or a digital signature EPRA(R)E_{PR_A}(R) with its private key.
  4. The server computes the expected value with its own copy of the secret (or verifies the signature with the public key) and grants access if they match.

Since RR is different each time, a captured response cannot be replayed, and the password is never exposed on the network. Examples: CHAP, HTTP digest authentication, Kerberos nonces, hardware tokens that answer a numeric challenge. Weaknesses: it is open to man-in-the-middle relaying and offline dictionary attacks if the secret is a weak password; the server needs to hold the secret (unless public-key based).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

Questions from TU BSc CSIT 2076 Cryptography (TU IOST board exam, 2076), TU BSc CSIT 2078 Cryptography (TU IOST board exam, 2078), TU BSc CSIT 2079 Cryptography (TU IOST board exam, 2079), TU BSc CSIT 2080 Cryptography (TU IOST board exam, 2080), TU BSc CSIT 2081 Cryptography (TU IOST board exam, 2081), TU BSc CSIT 2082 Cryptography (TU IOST board exam, 2082), TU BSc CSIT 2076 Design and Analysis of Algorithms (TU IOST board exam, 2076), TU BSc CSIT 2078 Design and Analysis of Algorithms (TU IOST board exam, 2078), TU BSc CSIT 2079 Design and Analysis of Algorithms (TU IOST board exam, 2079), TU BSc CSIT 2080 Design and Analysis of Algorithms (TU IOST board exam, 2080), TU BSc CSIT 2081 Design and Analysis of Algorithms (TU IOST board exam, 2081), TU BSc CSIT 2082 Design and Analysis of Algorithms (TU IOST board exam, 2082), TU BSc CSIT 2080 Image Processing (TU IOST board exam, 2080), TU BSc CSIT 2081 Image Processing (TU IOST board exam, 2081), TU BSc CSIT 2082 Image Processing (TU IOST board exam, 2082), TU BSc CSIT 2080 Multimedia Computing (TU IOST board exam, 2080), TU BSc CSIT 2081 Multimedia Computing (TU IOST board exam, 2081), TU BSc CSIT 2082 Multimedia Computing (TU IOST board exam, 2082), TU BSc CSIT 2076 System Analysis and Design (TU IOST board exam, 2076), TU BSc CSIT 2078 System Analysis and Design (TU IOST board exam, 2078), TU BSc CSIT 2079 System Analysis and Design (TU IOST board exam, 2079), TU BSc CSIT 2080 System Analysis and Design (TU IOST board exam, 2080), TU BSc CSIT 2081 System Analysis and Design (TU IOST board exam, 2081), TU BSc CSIT 2082 System Analysis and Design (TU IOST board exam, 2082), TU BSc CSIT 2076 Society and Ethics in Information Technology (TU IOST board exam, 2076), TU BSc CSIT 2078 Society and Ethics in Information Technology (TU IOST board exam, 2078), TU BSc CSIT 2079 Society and Ethics in Information Technology (TU IOST board exam, 2079), TU BSc CSIT 2076 Simulation and Modeling (TU IOST board exam, 2076), TU BSc CSIT 2078 Simulation and Modeling (TU IOST board exam, 2078), TU BSc CSIT 2079 Simulation and Modeling (TU IOST board exam, 2079), TU BSc CSIT 2080 Simulation and Modeling (TU IOST board exam, 2080), TU BSc CSIT 2081 Simulation and Modeling (TU IOST board exam, 2081), TU BSc CSIT 2082 Simulation and Modeling (TU IOST board exam, 2082), TU BSc CSIT 2076 Web Technology (TU IOST board exam, 2076), TU BSc CSIT 2078 Web Technology (TU IOST board exam, 2078), TU BSc CSIT 2079 Web Technology (TU IOST board exam, 2079), TU BSc CSIT 2080 Web Technology (TU IOST board exam, 2080), TU BSc CSIT 2081 Web Technology (TU IOST board exam, 2081) and TU BSc CSIT 2082 Web Technology (TU IOST board exam, 2082). Answers are written for this site; check them against your class notes.