Browse papers
A

Section A: Long Answer Questions

Attempt any TWO questions.

3 questions·10 marks each
1long10 marks

What is a digital signature? Explain the digital signature scheme using RSA and the role of digital signatures in authentication and non-repudiation.

Digital Signature

A digital signature is a cryptographic value, computed from the data and a signer's private key, that binds the identity of the signer to the message. It provides authentication, data integrity, and non-repudiation. Unlike a handwritten signature, it is a function of the message itself, so any change to the message invalidates the signature.

Digital Signature Using RSA

RSA signing is the reverse of RSA encryption: the signer uses the private key to sign, and any verifier uses the public key to verify.

Key setup (same as RSA):

  • Choose primes p,qp, q; compute n=pqn = pq and ϕ(n)=(p1)(q1)\phi(n) = (p-1)(q-1).
  • Choose public exponent ee with gcd(e,ϕ(n))=1\gcd(e, \phi(n)) = 1; compute private exponent de1(modϕ(n))d \equiv e^{-1} \pmod{\phi(n)}.
  • Public key: (e,n)(e, n); private key: (d,n)(d, n).

Signing (by sender A): compute a hash h=H(M)h = H(M) of the message, then

S=hdmodn.S = h^{d} \bmod n.

A sends (M,S)(M, S).

Verification (by receiver B): using A's public key,

h=Semodn,h' = S^{e} \bmod n,

and independently compute H(M)H(M). If h=H(M)h' = H(M), the signature is valid.

In practice the message is hashed first (e.g. SHA-256) so that signing works on a fixed-size digest and to prevent existential forgery.

Role in Authentication and Non-Repudiation

  • Authentication: Only the holder of the private key could have produced SS such that SemodnS^{e} \bmod n equals the message hash. Successful verification with A's public key proves the message came from A.
  • Integrity: If the message is altered in transit, H(M)H(M) changes and verification fails.
  • Non-repudiation: Because only A possesses the private key dd, A cannot later deny having signed the message — a third party can verify the signature using the publicly known key, providing legal/dispute-resolution evidence.
digital-signature
2long10 marks

Explain the RSA algorithm. Show how encryption and decryption are performed. Choose two primes p=7 and q=11, compute the public and private key pairs and encrypt the message M=8.

RSA Algorithm

RSA is a public-key (asymmetric) cryptosystem whose security rests on the difficulty of factoring large integers.

Key Generation

  1. Choose two large primes pp and qq.
  2. Compute n=p×qn = p \times q.
  3. Compute Euler's totient ϕ(n)=(p1)(q1)\phi(n) = (p-1)(q-1).
  4. Choose public exponent ee with 1<e<ϕ(n)1 < e < \phi(n) and gcd(e,ϕ(n))=1\gcd(e, \phi(n)) = 1.
  5. Compute private exponent de1(modϕ(n))d \equiv e^{-1} \pmod{\phi(n)}.
  • Public key: (e,n)(e, n) Private key: (d,n)(d, n).

Encryption / Decryption

  • Encryption: C=MemodnC = M^{e} \bmod n.
  • Decryption: M=CdmodnM = C^{d} \bmod n.

Worked Example: p=7p = 7, q=11q = 11, M=8M = 8

Step 1 — n: n=7×11=77n = 7 \times 11 = 77.

Step 2 — totient: ϕ(n)=(71)(111)=6×10=60\phi(n) = (7-1)(11-1) = 6 \times 10 = 60.

Step 3 — choose e: pick e=13e = 13 (since gcd(13,60)=1\gcd(13, 60) = 1).

Step 4 — compute d: find dd with 13d1(mod60)13d \equiv 1 \pmod{60}. 13×37=481=8×60+11(mod60)13 \times 37 = 481 = 8 \times 60 + 1 \equiv 1 \pmod{60}, so d=37d = 37.

  • Public key: (e,n)=(13,77)(e, n) = (13, 77)
  • Private key: (d,n)=(37,77)(d, n) = (37, 77)

Step 5 — encrypt M = 8:

C=Memodn=813mod77.C = M^{e} \bmod n = 8^{13} \bmod 77.

Using successive squaring mod 77:

  • 82=648^{2} = 64
  • 84=642=409615(mod77)8^{4} = 64^{2} = 4096 \equiv 15 \pmod{77}
  • 88=152=22571(mod77)8^{8} = 15^{2} = 225 \equiv 71 \pmod{77}
  • 813=888481=71×15×88^{13} = 8^{8} \cdot 8^{4} \cdot 8^{1} = 71 \times 15 \times 8.
  • 71×15=106564(mod77)71 \times 15 = 1065 \equiv 64 \pmod{77}; 64×8=51250(mod77)64 \times 8 = 512 \equiv 50 \pmod{77}.
C=50.\boxed{C = 50}.

(Check: decryption 5037mod77=850^{37} \bmod 77 = 8 recovers the message.)

rsa
3long10 marks

Explain the structure of the Data Encryption Standard (DES) algorithm with a block diagram. Describe a single round of DES including the function F.

Data Encryption Standard (DES)

DES is a symmetric block cipher that encrypts 64-bit plaintext blocks under a 56-bit effective key (64-bit key with 8 parity bits) using a 16-round Feistel network.

Overall Structure (Block Diagram in words)

64-bit Plaintext
      |
[Initial Permutation (IP)]
      |
  split -> L0 (32) | R0 (32)
      |
  Round 1  (uses subkey K1)
  Round 2  (uses subkey K2)
     ...
  Round 16 (uses subkey K16)
      |
  32-bit swap (R16 | L16)
      |
[Inverse Initial Permutation (IP^-1)]
      |
64-bit Ciphertext

A separate key schedule takes the 56-bit key, applies Permuted Choice 1 (PC-1), splits it into two 28-bit halves, and for each round performs left circular shifts followed by Permuted Choice 2 (PC-2) to produce sixteen 48-bit subkeys K1K16K_1 \dots K_{16}.

A Single DES Round (Feistel structure)

For round ii, given (Li1,Ri1)(L_{i-1}, R_{i-1}):

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

The right half is fed into the round function FF together with the round subkey, and the result is XORed with the left half.

The Function F (Mangler Function)

F(R,Ki)F(R, K_i) operates on a 32-bit input and a 48-bit subkey in four steps:

  1. Expansion (E): the 32-bit RR is expanded to 48 bits by the E-box (duplicating some bits).
  2. Key mixing: XOR the 48-bit expanded value with the 48-bit subkey KiK_i.
  3. Substitution (S-boxes): the 48 bits are split into eight 6-bit groups; each enters one of eight S-boxes, each outputting 4 bits → 32 bits total. The S-boxes provide non-linearity (confusion) and are the heart of DES security.
  4. Permutation (P): the 32-bit S-box output is permuted by the P-box to spread bits (diffusion).

After 16 rounds the halves are swapped and passed through IP1IP^{-1} to yield the ciphertext. Decryption uses the identical algorithm with subkeys applied in reverse order (K16K1K_{16} \dots K_1).

des
B

Section B: Short Answer Questions

Attempt any EIGHT questions.

9 questions·5 marks each
4short5 marks

Explain the basic logic of malicious code: viruses, worms and trojan horses.

Malicious Code

Virus: A program fragment that attaches itself to a host file/program and replicates by inserting copies into other programs when the infected host is executed. It needs a host and usually user action (running the file) to spread, and carries a payload that may damage data.

Worm: A stand-alone, self-replicating program that spreads across networks on its own, without attaching to a host or requiring user action. It exploits vulnerabilities to copy itself to other machines, consuming bandwidth and resources (e.g. the Morris worm).

Trojan Horse: A program that masquerades as legitimate/useful software but secretly performs malicious actions (data theft, backdoor installation). It does not self-replicate; it relies on tricking the user into running it.

FeatureVirusWormTrojan
Self-replicatingYesYesNo
Needs host fileYesNoNo
Spreads via network aloneNoYesNo
Relies on deceptionSometimesNoYes
malicious-code
5short5 marks

State the Chinese Remainder Theorem and use it to solve a system of congruences.

Chinese Remainder Theorem (CRT)

Statement: If m1,m2,,mkm_1, m_2, \dots, m_k are pairwise coprime positive integers, then the system

xa1(modm1),  xa2(modm2),  ,  xak(modmk)x \equiv a_1 \pmod{m_1},\; x \equiv a_2 \pmod{m_2},\; \dots,\; x \equiv a_k \pmod{m_k}

has a unique solution modulo M=m1m2mkM = m_1 m_2 \cdots m_k.

Construction: Let Mi=M/miM_i = M/m_i and yiMi1(modmi)y_i \equiv M_i^{-1} \pmod{m_i}. Then

xi=1kaiMiyi(modM).x \equiv \sum_{i=1}^{k} a_i M_i y_i \pmod{M}.

Example

Solve: x2(mod3),  x3(mod5),  x2(mod7)x \equiv 2 \pmod 3,\; x \equiv 3 \pmod 5,\; x \equiv 2 \pmod 7.

  • M=357=105M = 3 \cdot 5 \cdot 7 = 105.
  • M1=35M_1 = 35, M2=21M_2 = 21, M3=15M_3 = 15.
  • Inverses: 352(mod3)y1=235 \equiv 2 \pmod 3 \Rightarrow y_1 = 2 (since 22=412\cdot2=4\equiv1). 211(mod5)y2=121 \equiv 1 \pmod 5 \Rightarrow y_2 = 1. 151(mod7)y3=115 \equiv 1 \pmod 7 \Rightarrow y_3 = 1.
  • x=2(35)(2)+3(21)(1)+2(15)(1)=140+63+30=233x = 2(35)(2) + 3(21)(1) + 2(15)(1) = 140 + 63 + 30 = 233.
  • 233mod105=23233 \bmod 105 = 23.
x23(mod105).\boxed{x \equiv 23 \pmod{105}}.

Check: 23=73+22(mod3)23 = 7\cdot3+2 \equiv 2 \pmod3, 23=45+33(mod5)23 = 4\cdot5+3 \equiv 3\pmod5, 23=37+22(mod7)23 = 3\cdot7+2 \equiv 2\pmod7. ✓

chinese-remainder
6short5 marks

Explain the goals of security: confidentiality, integrity and availability. List the different types of security attacks.

Goals of Security (CIA Triad)

  • Confidentiality: Ensures information is accessible only to authorized parties; data is protected from unauthorized disclosure (achieved via encryption, access control).
  • Integrity: Ensures information is not altered in an unauthorized or undetected manner; data remains accurate and trustworthy (achieved via hashes, MACs, digital signatures).
  • Availability: Ensures information and resources are accessible to authorized users when needed; systems resist disruption (achieved via redundancy, backups, DoS protection).

Types of Security Attacks

Passive attacks (eavesdropping; threaten confidentiality):

  • Release of message contents (interception/snooping).
  • Traffic analysis (inferring info from message patterns).

Active attacks (modify data/stream; threaten integrity & availability):

  • Masquerade (impersonation / fabrication of identity).
  • Replay (capturing and retransmitting data).
  • Modification of messages (altering message contents).
  • Denial of Service (DoS) (disrupting availability).

In terms of information flow these correspond to interception, modification, fabrication, and interruption.

security-services
7short5 marks

Differentiate between symmetric and asymmetric key cryptography with examples.

Symmetric vs Asymmetric Key Cryptography

AspectSymmetric KeyAsymmetric (Public) Key
KeysSingle shared secret key for both encrypt & decryptKey pair: public key encrypts, private key decrypts
Key sharingKey must be secretly distributed (key-distribution problem)Public key shared openly; private key kept secret
SpeedFast, suitable for bulk dataSlow (heavy math), used for small data/keys
Number of keys (n users)n(n1)/2n(n-1)/2 keys needed2n2n keys (one pair per user)
ServicesConfidentialityConfidentiality, key exchange, digital signatures, non-repudiation
ExamplesDES, 3DES, AES, RC4, BlowfishRSA, Diffie-Hellman, ElGamal, ECC

In practice the two are combined (hybrid cryptography): an asymmetric algorithm (e.g. RSA) securely exchanges a session key, and a fast symmetric algorithm (e.g. AES) encrypts the actual bulk data.

symmetric-asymmetric
8short5 marks

Explain the Caesar cipher and the mono-alphabetic substitution cipher with examples of their cryptanalysis.

Caesar Cipher

A monoalphabetic substitution cipher that shifts each letter by a fixed amount kk (classically k=3k=3):

C=(P+k)mod26,P=(Ck)mod26.C = (P + k) \bmod 26, \qquad P = (C - k) \bmod 26.

Example (k=3k=3): plaintext HELLO → ciphertext KHOOR.

Cryptanalysis: There are only 25 possible keys, so it is broken by brute force (exhaustive key search) — try all shifts until readable text appears.

General Monoalphabetic Substitution Cipher

Each plaintext letter is mapped to a fixed but arbitrary ciphertext letter (a permutation of the alphabet), giving 26!4×102626! \approx 4 \times 10^{26} keys — far too many for brute force.

Cryptanalysis: Broken by frequency analysis, because the cipher preserves letter-frequency statistics of the language. The analyst:

  1. Counts ciphertext letter frequencies.
  2. Maps the most frequent ciphertext letters to common English letters (E, T, A, O...).
  3. Uses digram/trigram patterns (TH, THE) to confirm and complete the substitution.

Thus, despite the huge key space, the monoalphabetic cipher is insecure because it does not hide the underlying language statistics.

caesar-cipher
9short5 marks

Explain modular arithmetic and Euler's totient function. Compute phi(35) and phi(24).

Modular Arithmetic

Modular arithmetic is arithmetic over a fixed modulus nn, where numbers "wrap around" after reaching nn. We write ab(modn)a \equiv b \pmod n if n(ab)n \mid (a-b), i.e. aa and bb leave the same remainder when divided by nn. Operations +,,×+, -, \times are well-defined on residue classes {0,1,,n1}\{0,1,\dots,n-1\}. It is the foundation of most public-key cryptography (RSA, Diffie-Hellman, ElGamal).

Euler's Totient Function ϕ(n)\phi(n)

ϕ(n)\phi(n) counts the integers in {1,2,,n}\{1, 2, \dots, n\} that are coprime to nn.

  • For a prime pp: ϕ(p)=p1\phi(p) = p-1.
  • For n=pkn = p^{k}: ϕ(pk)=pkpk1\phi(p^k) = p^k - p^{k-1}.
  • Multiplicative: if gcd(m,n)=1\gcd(m,n)=1 then ϕ(mn)=ϕ(m)ϕ(n)\phi(mn) = \phi(m)\phi(n).

Euler's theorem: if gcd(a,n)=1\gcd(a,n)=1 then aϕ(n)1(modn)a^{\phi(n)} \equiv 1 \pmod n.

Computations

ϕ(35)\phi(35): 35=5×735 = 5 \times 7 (both prime, coprime), so

ϕ(35)=ϕ(5)ϕ(7)=4×6=24.\phi(35) = \phi(5)\,\phi(7) = 4 \times 6 = \boxed{24}.

ϕ(24)\phi(24): 24=23×324 = 2^{3} \times 3, so

ϕ(24)=ϕ(23)ϕ(3)=(84)(31)=4×2=8.\phi(24) = \phi(2^3)\,\phi(3) = (8-4)(3-1) = 4 \times 2 = \boxed{8}.
modular-arithmetic
10short5 marks

Explain the ElGamal cryptographic system for encryption and decryption.

ElGamal Cryptosystem

ElGamal is a public-key cryptosystem whose security relies on the difficulty of the Discrete Logarithm Problem in a finite cyclic group.

Key Generation

  1. Choose a large prime pp and a primitive root (generator) gg of Zp\mathbb{Z}_p^{*}.
  2. Choose a private key xx with 1<x<p11 < x < p-1.
  3. Compute y=gxmodpy = g^{x} \bmod p.
  • Public key: (p,g,y)(p, g, y) Private key: xx.

Encryption (of message MM, M<pM < p)

Sender picks a random ephemeral key kk (1<k<p11 < k < p-1) and computes:

C1=gkmodp,C2=Mykmodp.C_1 = g^{k} \bmod p, \qquad C_2 = M \cdot y^{k} \bmod p.

Ciphertext is the pair (C1,C2)(C_1, C_2).

Decryption

Receiver uses private key xx:

M=C2(C1x)1modp=C2C1p1xmodp.M = C_2 \cdot (C_1^{x})^{-1} \bmod p = C_2 \cdot C_1^{\,p-1-x} \bmod p.

This works because C1x=gkx=ykC_1^{x} = g^{kx} = y^{k}, which cancels the yky^k factor in C2C_2.

Example (small numbers)

Let p=11p=11, g=2g=2, x=3x=3y=23mod11=8y = 2^3 \bmod 11 = 8. Public key (11,2,8)(11,2,8). To encrypt M=7M=7 with k=4k=4: C1=24mod11=5C_1 = 2^4 \bmod 11 = 5, C2=784mod11=74=286C_2 = 7 \cdot 8^4 \bmod 11 = 7 \cdot 4 = 28 \equiv 6. Ciphertext (5,6)(5,6).

Note: Because of the random kk, ElGamal is probabilistic — the same message encrypts to different ciphertexts each time, and the ciphertext is roughly twice the message size.

elgamal
11short5 marks

Differentiate between block ciphers and stream ciphers. Explain the different modes of operation of block ciphers.

Block Cipher vs Stream Cipher

AspectBlock CipherStream Cipher
Processing unitFixed-size blocks (e.g. 64/128 bits)One bit/byte at a time
MechanismSubstitution-permutation / FeistelXOR plaintext with a pseudorandom keystream
Speed/latencySlower, needs full blockFast, low latency
Error propagationErrors affect whole block (mode-dependent)Error usually stays in one bit/byte
ExamplesDES, 3DES, AESRC4, A5/1, ChaCha20

Modes of Operation of Block Ciphers

  1. ECB (Electronic Codebook): Each block encrypted independently: Ci=EK(Pi)C_i = E_K(P_i). Simple but identical plaintext blocks give identical ciphertext (leaks patterns) — insecure for structured data.
  2. CBC (Cipher Block Chaining): Each plaintext block is XORed with the previous ciphertext before encryption: Ci=EK(PiCi1)C_i = E_K(P_i \oplus C_{i-1}), with C0=IVC_0 = IV. Hides patterns; errors propagate to two blocks.
  3. CFB (Cipher Feedback): Turns the block cipher into a self-synchronizing stream cipher: Ci=PiEK(Ci1)C_i = P_i \oplus E_K(C_{i-1}).
  4. OFB (Output Feedback): Generates a keystream independent of plaintext: Oi=EK(Oi1)O_i = E_K(O_{i-1}), Ci=PiOiC_i = P_i \oplus O_i. No error propagation.
  5. CTR (Counter): Encrypts an incrementing counter to form a keystream: Ci=PiEK(counteri)C_i = P_i \oplus E_K(\text{counter}_i). Parallelizable and random-access.

All feedback modes require an Initialization Vector (IV) to ensure that identical plaintexts encrypt differently.

block-stream
12short5 marks

What is a Message Authentication Code (MAC)? Explain how HMAC works.

Message Authentication Code (MAC)

A MAC is a short, fixed-length tag computed from a message and a shared secret key KK: MAC=CK(M)\text{MAC} = C_K(M). It provides data integrity and authentication — the receiver, who shares KK, recomputes the MAC and accepts the message only if the tags match. An attacker without KK cannot forge a valid tag for a modified message. (A MAC does not provide non-repudiation, since both parties share the key.)

HMAC (Hash-based MAC)

HMAC builds a MAC from a cryptographic hash function HH (e.g. SHA-256) and a secret key KK, defined as:

HMAC(K,M)=H((Kopad)H((Kipad)M))\text{HMAC}(K, M) = H\big((K \oplus opad)\,\|\,H((K \oplus ipad)\,\|\,M)\big)

where:

  • ipadipad = the byte 0x36 repeated to block size,
  • opadopad = the byte 0x5C repeated to block size,
  • \| denotes concatenation, \oplus is XOR, and KK is padded to the hash block size.

How it works:

  1. The key is padded and XORed with ipadipad, prepended to the message, and hashed → inner hash.
  2. The key is padded and XORed with opadopad, prepended to the inner hash, and hashed again → final HMAC.

The two nested hashes with two key-derived values make HMAC resistant to length-extension and other attacks, so its security depends only on the strength of the underlying hash and the secrecy of KK.

mac

Frequently asked questions

Where can I find the BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) question paper 2081?
The full BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2081 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
Does the Cryptography (BSc CSIT, CSC316) 2081 paper come with solutions?
Yes. Every question on this Cryptography (BSc CSIT, CSC316) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
How many marks is the BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2081 paper?
The BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2081 paper carries 60 full marks and is meant to be completed in 180 minutes, across 12 questions.
Is practising this Cryptography (BSc CSIT, CSC316) past paper free?
Yes — reading and attempting this Cryptography (BSc CSIT, CSC316) past paper on Kekkei is completely free.