Browse papers
A

Section A: Long Answer Questions

Attempt any TWO questions.

3 questions·10 marks each
1long10 marks

What are cryptographic hash functions? Explain the SHA-1 algorithm and describe how a 160-bit message digest is generated.

Cryptographic Hash Functions

A cryptographic hash function HH maps a message MM of arbitrary length to a fixed-length output h=H(M)h = H(M) called the message digest. It must satisfy:

  • Pre-image resistance (one-way): given hh, it is infeasible to find MM with H(M)=hH(M)=h.
  • Second pre-image resistance: given MM, it is infeasible to find MMM' \neq M with H(M)=H(M)H(M')=H(M).
  • Collision resistance: it is infeasible to find any pair (M,M)(M, M') with H(M)=H(M)H(M)=H(M').
  • Avalanche effect: a 1-bit change in input flips ~half the output bits.

Uses: integrity checks, digital signatures, MACs, password storage.

SHA-1 Algorithm

SHA-1 takes a message of length <264< 2^{64} bits and produces a 160-bit digest. It follows the Merkle–Damgård construction.

Step 1 – Padding. Append a 1 bit, then 0 bits, until the length 448(mod512)\equiv 448 \pmod{512}. Append the original message length as a 64-bit integer, making the total a multiple of 512 bits.

Step 2 – Parse into blocks. Split into NN blocks M1,,MNM_1,\dots,M_N of 512 bits each; each block is 16 words of 32 bits.

Step 3 – Initialize 5 chaining variables (160 bits total):

H0=67452301, H1=EFCDAB89, H2=98BADCFE, H3=10325476, H4=C3D2E1F0H_0=\texttt{67452301},\ H_1=\texttt{EFCDAB89},\ H_2=\texttt{98BADCFE},\ H_3=\texttt{10325476},\ H_4=\texttt{C3D2E1F0}

Step 4 – Message schedule. Expand the 16 words W0..W15W_0..W_{15} to 80 words:

Wt=ROTL1(Wt3Wt8Wt14Wt16),16t79W_t = \mathrm{ROTL}^1(W_{t-3}\oplus W_{t-8}\oplus W_{t-14}\oplus W_{t-16}),\quad 16\le t\le 79

Step 5 – Compression (80 rounds in 4 stages of 20). Set a,b,c,d,e=H0..H4a,b,c,d,e = H_0..H_4. For t=0..79t=0..79:

T=ROTL5(a)+ft(b,c,d)+e+Wt+KtT = \mathrm{ROTL}^5(a) + f_t(b,c,d) + e + W_t + K_t e=d, d=c, c=ROTL30(b), b=a, a=Te=d,\ d=c,\ c=\mathrm{ROTL}^{30}(b),\ b=a,\ a=T

where the round function and constant change each 20-round stage:

Roundsft(b,c,d)f_t(b,c,d)KtK_t
0–19(bc)(¬bd)(b\wedge c)\vee(\lnot b\wedge d)5A827999
20–39bcdb\oplus c\oplus d6ED9EBA1
40–59(bc)(bd)(cd)(b\wedge c)\vee(b\wedge d)\vee(c\wedge d)8F1BBCDC
60–79bcdb\oplus c\oplus dCA62C1D6

Step 6 – Update chaining values (mod 2322^{32}):

HiHi+{a,b,c,d,e}iH_i \leftarrow H_i + \{a,b,c,d,e\}_i

Process all blocks; the final 160-bit digest is the concatenation H0H1H2H3H4H_0\Vert H_1\Vert H_2\Vert H_3\Vert H_4.

SHA-1 is now considered broken for collision resistance (the 2017 SHAttered attack) and is deprecated in favour of SHA-2/SHA-3.

hash-functions
2long10 marks

Explain classical encryption techniques. Describe the Playfair cipher and the Hill cipher with examples of encryption.

Classical Encryption Techniques

Classical ciphers are symmetric and fall into two families:

  • Substitution – replace plaintext units with other symbols (Caesar, Playfair, Hill, Vigenère).
  • Transposition – rearrange the positions of plaintext characters (rail fence, columnar).

Playfair Cipher

A digraph substitution cipher using a 5×55\times5 key matrix (I/J share a cell).

Key = MONARCHY, fill remaining letters of alphabet:

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

Rules (process plaintext as pairs; insert X between repeats, pad with X):

  1. Same row → take letter to the right (wrap).
  2. Same column → take letter below (wrap).
  3. Otherwise (rectangle) → take the letter in the same row but the other pair's column.

Example: plaintext BALLOONBA LX LO ON

  • BA → IB
  • LX → SU
  • LO → PM (rectangle)
  • ON → NA

Ciphertext = IBSUPMNA.

Hill Cipher

A polygraphic cipher using linear algebra mod 26. For block size nn, choose an invertible key matrix KK (gcd(detK,26)=1\gcd(\det K,26)=1). Encryption:

C=KP(mod26),P=K1C(mod26)C = K\,P \pmod{26},\qquad P = K^{-1}C \pmod{26}

Example (n=2n=2): Let K=(3325)K=\begin{pmatrix}3 & 3\\ 2 & 5\end{pmatrix}, plaintext HI P=(78)\to P=\begin{pmatrix}7\\8\end{pmatrix}.

C=(3325)(78)=(4554)(192)(mod26)C=\begin{pmatrix}3&3\\2&5\end{pmatrix}\begin{pmatrix}7\\8\end{pmatrix}=\begin{pmatrix}45\\54\end{pmatrix}\equiv\begin{pmatrix}19\\2\end{pmatrix}\pmod{26}

Ciphertext = letters 19,2 = TC.

Decryption uses K1K^{-1}, computed via K1=(detK)1adj(K)mod26K^{-1}=(\det K)^{-1}\,\mathrm{adj}(K)\bmod 26. Here detK=156=9\det K=15-6=9, 91mod26=39^{-1}\bmod 26=3, giving K1=(1517209)K^{-1}=\begin{pmatrix}15&17\\20&9\end{pmatrix}, which recovers HI.

classical-ciphers
3long10 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 a message and the signer's private key, that lets anyone verify the message's origin and integrity using the signer's public key. It is the digital analogue of a handwritten signature but also binds to the message content.

Properties provided:

  • Authentication – verifier is assured of the signer's identity.
  • Integrity – any change to the message invalidates the signature.
  • Non-repudiation – the signer cannot later deny signing, since only they hold the private key.

RSA Digital Signature Scheme

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

Signing (signer uses private key on the hash of the message):

h=H(M),S=hdmodnh = H(M),\qquad S = h^{\,d} \bmod n

The signer sends (M,S)(M, S).

Verification (verifier uses signer's public key):

h=Semodn,accept iff h=H(M)h' = S^{\,e} \bmod n,\qquad \text{accept iff } h' = H(M)

Because (hd)eh(modn)(h^d)^e \equiv h \pmod n, a valid signature recovers the hash. Signing the hash rather than MM keeps signatures short and avoids existential forgery on raw RSA.

Tiny example: p=5,q=11,n=55,ϕ=40p=5,q=11,n=55,\phi=40; e=3e=3, d=27d=27 (since 327=811mod403\cdot27=81\equiv1\bmod40). If H(M)=4H(M)=4: S=427mod55=9S=4^{27}\bmod55=9. Verify: 93mod55=4=H(M)9^{3}\bmod55=4=H(M) ✓.

Role in Authentication and Non-repudiation

  • Authentication: only the holder of the private key could have produced SS that verifies under the matching public key, proving identity.
  • Non-repudiation: the binding between signer and message is verifiable by any third party, so the signer cannot deny authorship — essential for contracts, e-commerce and certificates. (Trust in the public key itself is established through a PKI / Certificate Authority.)
digital-signature
B

Section B: Short Answer Questions

Attempt any EIGHT questions.

9 questions·5 marks each
4short5 marks

State and explain Fermat's little theorem and Euler's theorem with examples.

Fermat's Little Theorem

If pp is prime and gcd(a,p)=1\gcd(a,p)=1, then

ap11(modp).a^{\,p-1} \equiv 1 \pmod{p}.

Equivalently apa(modp)a^{p}\equiv a\pmod p for all aa.

Example: p=7, a=3p=7,\ a=3: 36=729=1047+11(mod7)3^{6}=729=104\cdot7+1\equiv 1\pmod 7. ✓

Euler's Theorem

If gcd(a,n)=1\gcd(a,n)=1, then

aϕ(n)1(modn),a^{\,\phi(n)} \equiv 1 \pmod{n},

where ϕ(n)\phi(n) is Euler's totient (count of integers in [1,n][1,n] coprime to nn). It generalises Fermat's theorem (for prime pp, ϕ(p)=p1\phi(p)=p-1).

Example: n=10, ϕ(10)=4, a=3n=10,\ \phi(10)=4,\ a=3: 34=811(mod10)3^{4}=81\equiv 1\pmod{10}. ✓

Relevance: these theorems underpin RSA — the decryption exponent works because med=m1+kϕ(n)m(modn)m^{ed}=m^{1+k\phi(n)}\equiv m\pmod n — and enable fast modular exponentiation.

fermat-euler
5short5 marks

Is a man-in-the-middle attack possible in the Diffie-Hellman algorithm? Justify your answer.

Yes — Diffie–Hellman is vulnerable to a Man-in-the-Middle (MITM) attack.

Plain Diffie–Hellman exchanges public values but provides no authentication of the parties, so an active attacker can sit between Alice and Bob.

The attack: Alice and Bob agree on prime pp and generator gg.

  • Alice sends A=gamodpA=g^{a}\bmod p; attacker Mallory intercepts it and instead sends Bob M=gmmodpM=g^{m}\bmod p.
  • Bob sends B=gbmodpB=g^{b}\bmod p; Mallory intercepts and sends Alice MM.
  • Alice computes shared key K1=Ma=gammodpK_1=M^{a}=g^{am}\bmod p.
  • Bob computes shared key K2=Mb=gbmmodpK_2=M^{b}=g^{bm}\bmod p.

Now Mallory shares K1K_1 with Alice and K2K_2 with Bob, can decrypt, read/modify, and re-encrypt all traffic — neither party detects it.

Why: DH guarantees secrecy of the discrete log but does not bind a public value to an identity.

Countermeasure: authenticated Diffie–Hellman — sign the exchanged values (e.g., station-to-station protocol), use certificates/PKI, or combine DH with pre-shared keys, so each side verifies the peer's identity.

mim-attack
6short5 marks

Explain the families of SHA-2 and their differences from SHA-1.

SHA-2 Family

SHA-2 is a family of cryptographic hash functions standardised by NIST (FIPS 180-4), built on the Merkle–Damgård structure with two core compression functions (32-bit word for shorter, 64-bit word for longer variants):

VariantDigest sizeWord sizeBlock sizeRounds
SHA-224224 bits32-bit512 bits64
SHA-256256 bits32-bit512 bits64
SHA-384384 bits64-bit1024 bits80
SHA-512512 bits64-bit1024 bits80
SHA-512/224, SHA-512/256224/256 bits64-bit1024 bits80

SHA-224 is a truncated SHA-256 with different IVs; SHA-384 and SHA-512/t are truncated SHA-512.

Differences from SHA-1

AspectSHA-1SHA-2
Digest length160 bits (fixed)224–512 bits (selectable)
Rounds8064 (256-family) / 80 (512-family)
Working variables5 (a..ea..e)8 (a..ha..h)
Message schedulesimple XOR + ROTL¹richer σ0,σ1\sigma_0,\sigma_1 functions
Securitybroken (collisions found, 2017)no practical collision attack
Each round constant4 constants (one per 20 rounds)distinct constant KtK_t every round

Summary: SHA-2 offers longer digests, more chaining variables, a stronger message schedule and per-round constants, giving far greater collision resistance than SHA-1.

sha2
7short5 marks

What is Public Key Infrastructure (PKI)? Explain the role of a Certificate Authority and digital certificates.

Public Key Infrastructure (PKI)

PKI is the framework of hardware, software, policies, standards and procedures used to create, manage, distribute, store and revoke digital certificates and public keys. It solves the key-distribution / trust problem of asymmetric cryptography by reliably binding a public key to a verified identity.

Main components:

  • Certificate Authority (CA) – trusted third party that issues and signs certificates.
  • Registration Authority (RA) – verifies identity before the CA issues a certificate.
  • Certificate Repository / Directory – stores and publishes certificates.
  • CRL / OCSP – mechanisms to check revoked certificates.

Role of the Certificate Authority

The CA is the root of trust. It:

  1. Verifies the applicant's identity (via the RA).
  2. Binds the subject's identity to their public key and digitally signs the certificate with the CA's private key.
  3. Publishes and renews certificates, and revokes compromised ones (publishing a CRL).

Anyone holding the CA's public key can verify the CA's signature and thus trust the certified public key.

Digital Certificates

A digital certificate (typically X.509) is a signed data structure binding a public key to an identity. Key fields:

  • Version, serial number
  • Subject name and subject public key
  • Issuer (CA) name
  • Validity period (not-before / not-after)
  • Signature algorithm and the CA's digital signature

When a user presents a certificate, the verifier checks the CA's signature, the validity dates and revocation status before trusting the enclosed public key (used in TLS/HTTPS, S/MIME, code signing).

pki
8short5 marks

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

Malicious Code

Malicious code (malware) is software intentionally written to damage, disrupt or gain unauthorised access to systems. Three classic types:

Virus

A program fragment that attaches itself to a host program or file and replicates when that host is executed. It needs a host and usually user action (running the infected file) to spread. Phases: dormant → propagation → triggering → execution (payload). Example: boot-sector and macro viruses.

Worm

A standalone, self-replicating program that spreads automatically across networks by exploiting vulnerabilities, without needing a host file or user action. It consumes bandwidth/resources and propagates very fast. Example: the Morris worm, Code Red.

Trojan Horse

A program that appears legitimate/useful but hides a malicious payload. It does not self-replicate; it relies on tricking the user into installing it, then performs hidden actions such as opening a backdoor, stealing data or installing other malware.

Key Differences

FeatureVirusWormTrojan
Self-replicatingYes (with host)Yes (standalone)No
Needs host fileYesNoNo
Spreads over network aloneNoYesNo
Relies on deceptionSometimesNoYes
malicious-code
9short5 marks

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

Chinese Remainder Theorem (CRT)

If m1,m2,,mkm_1,m_2,\dots,m_k are pairwise coprime positive integers and M=m1m2mkM=m_1m_2\cdots m_k, 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 MM, given by

xi=1kaiMiyi(modM),Mi=Mmi,yi=Mi1modmi.x \equiv \sum_{i=1}^{k} a_i\,M_i\,y_i \pmod{M},\quad M_i=\frac{M}{m_i},\quad y_i = M_i^{-1}\bmod m_i.

Worked Example

Solve:

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

Here M=357=105M = 3\cdot5\cdot7 = 105.

iimim_iaia_iMi=105/miM_i=105/m_iyi=Mi1modmiy_i=M_i^{-1}\bmod m_i
1323535235\equiv2, 212y1=22^{-1}\equiv2 \Rightarrow y_1=2
25321211y2=121\equiv1 \Rightarrow y_2=1
37215151y3=115\equiv1 \Rightarrow y_3=1
x2352+3211+2151=140+63+30=233(mod105).x \equiv 2\cdot35\cdot2 + 3\cdot21\cdot1 + 2\cdot15\cdot1 = 140+63+30 = 233 \pmod{105}. 233=2105+23x23(mod105).233 = 2\cdot105 + 23 \Rightarrow x \equiv 23 \pmod{105}.

Check: 23mod3=223\bmod3=2 ✓, 23mod5=323\bmod5=3 ✓, 23mod7=223\bmod7=2 ✓. So x=23x=23 (CRT speeds up RSA decryption via mod pp and mod qq).

chinese-remainder
10short5 marks

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

Goals of Security (the CIA Triad)

  • Confidentiality – ensuring information is accessible only to authorised parties; prevents unauthorised disclosure. Achieved by encryption and access control.
  • Integrity – ensuring data is not altered in an unauthorised or undetected way; messages received are exactly as sent. Achieved by hashes, MACs and digital signatures.
  • Availability – ensuring authorised users can access systems and data when needed; resisting denial of service. Achieved by redundancy, backups and DoS protection.

(Often extended with Authentication and Non-repudiation.)

Types of Security Attacks

Passive attacks (observe, do not alter — hard to detect, prevent via encryption):

  • Release of message contents (eavesdropping)
  • Traffic analysis

Active attacks (alter data or affect operation — easier to detect, hard to prevent):

  • Masquerade – one entity pretends to be another
  • Replay – capturing and retransmitting data
  • Modification of messages – altering message contents
  • Denial of Service (DoS) – preventing legitimate use of resources

A further classification by Stallings: interruption (availability), interception (confidentiality), modification (integrity), and fabrication (authenticity).

security-services
11short5 marks

Differentiate between symmetric and asymmetric key cryptography with examples.

Symmetric vs Asymmetric Key Cryptography

Symmetric (secret-key): a single shared key is used for both encryption and decryption.

C=EK(P),P=DK(C).C=E_K(P),\qquad P=D_K(C).

Asymmetric (public-key): a mathematically related key pair — encrypt with the recipient's public key, decrypt with their private key (or sign with private, verify with public).

C=EPU(P),P=DPR(C).C=E_{PU}(P),\qquad P=D_{PR}(C).
AspectSymmetricAsymmetric
KeysOne shared secret keyPublic/private key pair
SpeedVery fastSlow (100–1000× slower)
Key distributionHard (must share secret securely)Easy (public key is open)
Number of keys for nn usersn(n1)2\dfrac{n(n-1)}{2}2n2n
Main useBulk data encryptionKey exchange, digital signatures
ExamplesDES, 3DES, AES, RC4, BlowfishRSA, Diffie–Hellman, ECC, ElGamal

Note: practical systems are hybrid — asymmetric crypto exchanges a symmetric session key, which then encrypts the bulk data (e.g., TLS).

symmetric-asymmetric
12short5 marks

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

Caesar Cipher

A mono-alphabetic shift cipher: each letter is shifted by a fixed key kk.

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

Example (k=3k=3): HELLOKHOOR.

Cryptanalysis: only 25 possible keys, so a brute-force attack trying every shift instantly breaks it. The key can also be found by recognising frequency patterns (e.g., the most common ciphertext letter likely maps to E).

Mono-alphabetic Substitution Cipher

Each plaintext letter maps to a fixed but arbitrary ciphertext letter (a permutation of the alphabet), giving a key space of 26!4×102626! \approx 4\times10^{26}, so brute force is infeasible.

Cryptanalysis: broken by frequency analysis, because the substitution preserves letter statistics:

  1. Count ciphertext letter frequencies and compare to English (E≈12.7%, T, A, O, I, N …).
  2. Map the most frequent ciphertext letters to common plaintext letters.
  3. Use digram/trigram patterns (TH, HE, THE, ING) and word structure to refine and confirm the key.

Conclusion: both ciphers fail because they hide letter identity but not letter frequency; only the key space differs (25 vs 26!26!), yet both succumb to statistical cryptanalysis.

caesar-cipher

Frequently asked questions

Where can I find the BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) question paper 2079?
The full BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2079 (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) 2079 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) 2079 paper?
The BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2079 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.