BSc CSIT (TU) Science Cryptography (BSc CSIT, CSC316) Question Paper 2078 Nepal
This is the official BSc CSIT (TU) (Science stream) Cryptography (BSc CSIT, CSC316) question paper for 2078, as set in the regular annual examination. It carries 60 full marks and a time allowance of 180 minutes, across 12 questions. On Kekkei you can attempt this Cryptography (BSc CSIT, CSC316) past paper online with a timer, get instant AI feedback and step-by-step solutions, and track the topics where you lose marks — completely free. Whether you are revising for your BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) exam or solving previous years' question papers, this 2078 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt any TWO questions.
Explain the Diffie-Hellman key exchange algorithm with an example. Show how an eavesdropper can perform a man-in-the-middle attack on this protocol.
Diffie-Hellman Key Exchange
The Diffie-Hellman (DH) algorithm allows two parties to agree on a shared secret key over an insecure channel without ever transmitting the key itself. Its security rests on the difficulty of the Discrete Logarithm Problem.
Algorithm
Public parameters (agreed in advance):
- A large prime .
- A primitive root modulo (the generator).
Steps:
- Alice picks a secret integer and computes ; she sends to Bob.
- Bob picks a secret integer and computes ; he sends to Alice.
- Alice computes .
- Bob computes .
Both obtain the same key because
Example ()
- Alice: .
- Bob: .
- Alice: .
- Bob: .
Shared secret . An eavesdropper sees but cannot find or without solving the discrete log.
Man-in-the-Middle (MITM) Attack
DH provides no authentication, so an attacker Mallory sitting between Alice and Bob can impersonate each to the other:
- Alice sends . Mallory intercepts it and instead sends her own to Bob.
- Bob sends . Mallory intercepts it and sends to Alice.
- Alice computes ; Mallory computes the same .
- Bob computes ; Mallory computes the same .
Now Mallory shares with Alice and with Bob. She decrypts every message from one side with one key and re-encrypts it with the other, reading and altering traffic while both believe they share a secret.
Countermeasure: Authenticate the exchanged public values, e.g. by signing and (digital signatures / certificates) — this gives authenticated Diffie-Hellman (as in TLS/IKE/STS).
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 maps an arbitrary-length message to a fixed-length output called the message digest. Required properties:
- Preimage resistance (one-way): given , infeasible to find with .
- Second-preimage resistance: given , infeasible to find with .
- Collision resistance: infeasible to find any pair with .
- Avalanche effect: a 1-bit input change flips ~half the output bits.
Uses: integrity checks, digital signatures, MACs, password storage.
SHA-1 Algorithm
SHA-1 produces a 160-bit digest using the Merkle-Damgård construction and processes the message in 512-bit blocks.
1. Padding
Append a 1 bit, then 0 bits, then a 64-bit length field so that the total length . Final length is a multiple of 512 bits.
2. Initialize the five 32-bit chaining variables
3. Process each 512-bit block
Expand the sixteen 32-bit words to eighty words:
Set . For run 80 rounds:
The round function and constant change every 20 rounds:
| Rounds | ||
|---|---|---|
| 0–19 | 5A827999 | |
| 20–39 | 6ED9EBA1 | |
| 40–59 | 8F1BBCDC | |
| 60–79 | CA62C1D6 |
4. Update chaining values
5. Output
After all blocks, the 160-bit digest is the concatenation
Note: SHA-1 is now considered broken for collision resistance (SHAttered attack, 2017) and is deprecated in favour of SHA-2/SHA-3.
Explain classical encryption techniques. Describe the Playfair cipher and the Hill cipher with examples of encryption.
Classical Encryption Techniques
Classical ciphers work on plaintext letters and fall into two classes:
- Substitution ciphers – replace letters with other symbols (Caesar, Playfair, Hill, Vigenère).
- Transposition ciphers – rearrange letter positions (Rail Fence, Columnar).
Playfair Cipher (digraph substitution)
Encrypts pairs of letters using a key matrix (I/J share a cell).
Key = "MONARCHY":
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 (after splitting plaintext into digraphs; insert X between repeated letters and pad if odd):
- Same row: replace each letter by the one to its right (wrap).
- Same column: replace each by the one below (wrap).
- Rectangle: replace each by the letter in its own row but the other letter's column.
Example: plaintext BALLOON → digraphs BA LX LO ON.
BA: rectangle →IBLX: rectangle →SULO: rectangle →PM(L row, O column = P; O row, L column = M)ON: same row →NA
Ciphertext = IBSUPMNA.
Hill Cipher (polygraphic, linear algebra)
Encrypts blocks of letters using an invertible key matrix modulo 26. Letters map .
Example with , plaintext HI = :
Ciphertext = TC. Decryption requires , which exists only when (here , coprime to 26).
Section B: Short Answer Questions
Attempt any EIGHT questions.
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 : . The sender appends the tag; the receiver recomputes it and accepts only if they match. A MAC provides data integrity and authentication (proof the message came from someone holding ), but not non-repudiation (both parties share the key) or confidentiality.
HMAC (Hash-based MAC)
HMAC builds a MAC from any cryptographic hash (e.g. SHA-256). It uses two padded constants — ipad (0x36 repeated) and opad (0x5C repeated) — and the key :
Steps:
- Pad/hash key to the block size.
- Inner hash: XOR key with
ipad, prepend to , hash it. - Outer hash: XOR key with
opad, prepend to the inner result, hash again.
The nested (two-pass) structure defeats length-extension attacks that affect plain , and HMAC is provably secure if the underlying hash's compression function is a PRF.
Explain key management and key distribution in symmetric cryptography.
Key Management and Distribution in Symmetric Cryptography
In symmetric cryptography both parties share one secret key, so the central problem is securely generating, distributing, storing and renewing that key. For users wanting pairwise communication, keys are needed — this key-explosion is the core scaling challenge.
Key Distribution Methods
- Physical/manual delivery: A hands the key to B in person or via courier. Secure but unscalable.
- Encrypted via an existing key: if A and B already share a key, a new session key can be sent encrypted under it.
- Third-party encrypted delivery: a trusted Key Distribution Center (KDC) shares a master key with each user and issues short-lived session keys on demand (the basis of Kerberos).
- Public-key based exchange: use a public-key method or Diffie-Hellman to establish the symmetric session key.
KDC Operation (typical)
- A requests a session key for B from the KDC.
- The KDC generates session key and sends it to A encrypted under A's master key, plus a ticket for B.
- A forwards the ticket; B decrypts it to obtain .
Key Lifecycle
Generation → distribution → storage (protected) → usage → periodic rotation → revocation/destruction. Session keys are short-lived to limit exposure; master keys are long-lived and heavily protected.
State and explain Fermat's little theorem and Euler's theorem with examples.
Fermat's Little Theorem
Statement: If is prime and , then
Equivalently, for any integer : .
Example: :
Euler's Theorem (generalisation)
Statement: If , then
where is Euler's totient = count of integers in coprime to . For prime , , so Fermat's theorem is the special case.
Example: . (the units ):
Relevance to cryptography: Euler's theorem underlies RSA — choosing guarantees , so decryption inverts encryption. It also speeds modular exponentiation by reducing exponents modulo .
Is a man-in-the-middle attack possible in the Diffie-Hellman algorithm? Justify your answer.
Is MITM Possible in Diffie-Hellman?
Yes. Plain Diffie-Hellman is vulnerable to a man-in-the-middle attack because it establishes a shared secret but provides no authentication of the communicating parties — neither side can verify that the public value it received actually came from the intended partner.
Why
An attacker Mallory between Alice and Bob can substitute her own public values:
- Alice sends ; Mallory replaces it with toward Bob.
- Bob sends ; Mallory replaces it with toward Alice.
- Alice forms with Mallory; Bob forms with Mallory.
Mallory now holds both keys, decrypting and re-encrypting all traffic while Alice and Bob believe they share one secret. The underlying discrete-log hardness is never broken — the weakness is the missing authentication.
Justification & Fix
The attack is possible precisely because messages and are unauthenticated. Authenticating the exchange — signing the public values with digital signatures, using certificates/PKI, or a password-authenticated variant (e.g. the Station-to-Station protocol, used in TLS and IKE) — prevents the substitution and stops the MITM attack.
Explain the families of SHA-2 and their differences from SHA-1.
The SHA-2 Family
SHA-2 is a family of cryptographic hash functions designed by the NSA and standardised by NIST (FIPS 180-4). It comprises six variants distinguished mainly by digest length and internal word size:
| Variant | Digest (bits) | Block size | Word size | Rounds |
|---|---|---|---|---|
| SHA-224 | 224 | 512 | 32-bit | 64 |
| SHA-256 | 256 | 512 | 32-bit | 64 |
| SHA-384 | 384 | 1024 | 64-bit | 80 |
| SHA-512 | 512 | 1024 | 64-bit | 80 |
| SHA-512/224 | 224 | 1024 | 64-bit | 80 |
| SHA-512/256 | 256 | 1024 | 64-bit | 80 |
SHA-224/256 use eight 32-bit working variables; SHA-384/512 use eight 64-bit variables (with truncated outputs for 224/384). The 224/384 versions are truncations of 256/512 with different initial hash values.
Differences from SHA-1
| Aspect | SHA-1 | SHA-2 |
|---|---|---|
| Digest size | 160 bits (fixed) | 224–512 bits (variable) |
| Working variables | 5 (×32-bit) | 8 (×32 or ×64-bit) |
| Rounds | 80 | 64 (SHA-256) / 80 (SHA-512) |
| Round function | one per 20 rounds, simple | richer functions (, Ch, Maj) + per-round constants |
| Security | broken (collisions found, 2017) | no practical collision; considered secure |
Summary: SHA-2 offers larger, configurable digests, more chaining variables, a stronger message-schedule and round function, and far greater collision resistance, making it the recommended replacement for the now-deprecated SHA-1.
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, people and procedures used to create, manage, distribute, store and revoke digital certificates and public keys. Its purpose is to reliably bind a public key to an identity, enabling authentication, confidentiality, integrity and non-repudiation in public-key cryptography.
Main components: Certificate Authority (CA), Registration Authority (RA), digital certificates, a certificate repository/directory, and a revocation mechanism (CRL / OCSP).
Certificate Authority (CA)
The CA is the trusted third party that:
- Verifies an applicant's identity (often via an RA).
- Issues digital certificates by signing them with the CA's private key.
- Maintains and publishes Certificate Revocation Lists (CRLs) for compromised/expired certificates.
- Forms a chain of trust: root CA → intermediate CAs → end-entity certificates.
Digital Certificate (X.509)
A digital certificate is a signed data structure that binds a public key to its owner. An X.509 certificate contains:
- Version, serial number.
- Subject name (owner) and the subject's public key.
- Issuer name (the CA).
- Validity period (not-before / not-after).
- Signature algorithm and the CA's digital signature over the certificate.
A relying party trusts the certificate by verifying the CA's signature with the CA's (already trusted) public key, thereby trusting the bound public key without prior contact.
Explain the basic logic of malicious code: viruses, worms and trojan horses.
Malicious Code (Malware)
Malicious code is software intentionally written to damage, disrupt or gain unauthorised access to systems and data.
1. Virus
A virus is a code fragment that attaches itself to a host program or file and cannot run independently — it executes when the infected host is run. On execution it replicates by inserting copies into other programs/files and may carry a payload (corrupting data, displaying messages). Spread requires user action (running the host), e.g. boot-sector, file-infector and macro viruses.
2. Worm
A worm is a standalone program that does not need a host and self-propagates across networks automatically by exploiting vulnerabilities or using email/file shares — no user action required. Because it replicates autonomously, a worm can spread extremely fast and consume bandwidth/resources (e.g. Code Red, ILOVEYOU, Conficker).
3. Trojan Horse
A trojan horse is a program that disguises itself as legitimate or useful software but hides malicious functionality (backdoor, data theft, spyware). It does not self-replicate; it relies on the user being tricked into installing/running it.
| Feature | Virus | Worm | Trojan |
|---|---|---|---|
| Needs a host | Yes | No | No |
| Self-replicates | Yes | Yes (over network) | No |
| Spreads via | infected files/user action | network, automatic | social engineering |
State the Chinese Remainder Theorem and use it to solve a system of congruences.
Chinese Remainder Theorem (CRT)
Statement: If are pairwise coprime positive integers, then the system of congruences
has a unique solution modulo .
Solution Method
Let , , and . Then
Worked Example
Solve:
| 1 | 3 | 2 | 35 | , ⇒ |
| 2 | 5 | 3 | 21 | , ⇒ |
| 3 | 7 | 2 | 15 | , ⇒ |
Answer: . Check: , , . ✓
CRT is widely used in cryptography to speed up RSA decryption by working modulo the prime factors and separately.
Explain the goals of security: confidentiality, integrity and availability. List the different types of security attacks.
Goals of Security (CIA Triad)
- Confidentiality: ensure information is accessible only to authorised parties; prevent unauthorised disclosure. Achieved by encryption and access control.
- Integrity: ensure data is accurate and not modified in an unauthorised way; detect tampering. Achieved with hashes, MACs and digital signatures.
- Availability: ensure systems and data are accessible to authorised users when needed. Threatened by Denial-of-Service attacks; protected by redundancy, backups and DoS mitigation.
Supporting goals: authentication, non-repudiation and access control.
Types of Security Attacks
By effect (passive vs active):
- Passive attacks – attacker only observes; no modification. Hard to detect.
- Release of message contents (eavesdropping).
- Traffic analysis (inferring info from patterns/metadata).
- Active attacks – attacker alters data or operation; easier to detect, harder to prevent.
- Masquerade – impersonating another entity.
- Replay – capturing and re-sending valid data.
- Modification of messages – altering content.
- Denial of Service (DoS) – disrupting availability.
By security-goal violated (Stallings model):
- Interception → confidentiality.
- Interruption → availability.
- Modification → integrity.
- Fabrication → authenticity.
Frequently asked questions
- Where can I find the BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) question paper 2078?
- The full BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2078 (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) 2078 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) 2078 paper?
- The BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2078 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.