BSc CSIT (TU) Science Cryptography (BSc CSIT, CSC316) Question Paper 2077 Nepal
This is the official BSc CSIT (TU) (Science stream) Cryptography (BSc CSIT, CSC316) question paper for 2077, 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 2077 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt any TWO questions.
Explain the structure of the Advanced Encryption Standard (AES) algorithm. Describe the four transformations: SubBytes, ShiftRows, MixColumns and AddRoundKey with examples.
Advanced Encryption Standard (AES)
AES is a symmetric-key block cipher standardized by NIST (FIPS-197) in 2001 as a replacement for DES. It encrypts a 128-bit block using keys of 128, 192 or 256 bits, giving 10, 12 or 14 rounds respectively. Unlike DES it is not a Feistel network; every byte of the block is transformed in each round (a substitution-permutation network).
State and structure
The 128-bit input is arranged column-wise into a matrix of bytes called the state. The key is expanded by the key schedule into round keys. The overall flow is:
AddRoundKey (initial)
for round = 1 to Nr-1:
SubBytes -> ShiftRows -> MixColumns -> AddRoundKey
final round (Nr):
SubBytes -> ShiftRows -> AddRoundKey // no MixColumns
The four transformations
1. SubBytes (non-linear substitution) Each byte is replaced using a fixed S-box derived from the multiplicative inverse in followed by an affine transform. It provides confusion. Example: byte → S-box row 5, column 3 → .
2. ShiftRows (cyclic permutation) Rows of the state are cyclically left-shifted: row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 bytes. This spreads bytes across columns (diffusion).
[a0 a1 a2 a3] [a0 a1 a2 a3]
[b0 b1 b2 b3] -> [b1 b2 b3 b0]
[c0 c1 c2 c3] [c2 c3 c0 c1]
[d0 d1 d2 d3] [d3 d0 d1 d2]
3. MixColumns (linear mixing) Each column is treated as a polynomial over and multiplied (mod ) by the fixed matrix:
Multiplications are in with reducing polynomial . This gives strong inter-byte diffusion. It is omitted in the last round.
4. AddRoundKey The 128-bit round key is XORed byte-by-byte with the state: . This is the only step that depends on the secret key.
Decryption
Decryption uses the inverse transformations (InvSubBytes, InvShiftRows, InvMixColumns, AddRoundKey) with round keys applied in reverse order.
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
Diffie-Hellman (1976) lets two parties establish a shared secret over an insecure channel without prior secrets. Its security rests on the hardness of the discrete logarithm problem.
Protocol
Public parameters: a large prime and a primitive root (generator) of .
- Alice picks secret , sends .
- Bob picks secret , sends .
- Alice computes ; Bob computes .
- Both obtain .
Example ()
- Alice: .
- Bob: .
- Alice: .
- Bob: .
Shared secret . An eavesdropper sees but cannot easily compute or (discrete log).
Man-in-the-Middle (MITM) Attack
Plain DH provides no authentication, so an active attacker Mallory sitting between Alice and Bob can intercept and substitute keys:
- Mallory chooses own secrets .
- Alice sends ; Mallory intercepts and sends to Bob.
- Bob sends ; Mallory intercepts and sends to Alice.
- Alice computes — shared with Mallory (who computes ).
- Bob computes — also shared with Mallory.
Mallory now shares one key with Alice and another with Bob. He decrypts, reads/alters, and re-encrypts every message, relaying it transparently. Neither party detects the attack.
Countermeasure: authenticate the exchanged values, e.g. authenticated/station-to-station DH, signing and , or using certificates (PKI).
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 message digest: . Required properties:
- Preimage resistance — given , infeasible to find with .
- Second-preimage resistance — given , infeasible to find with .
- Collision resistance — infeasible to find any pair with .
Uses: integrity checks, digital signatures, MACs, password storage.
SHA-1 Algorithm
SHA-1 produces a 160-bit digest. It follows the Merkle-Damgård construction.
Step 1 — Padding: Append a single 1 bit, then 0s, then the original 64-bit message length, so the total length is a multiple of 512 bits.
Step 2 — Parse the padded message into 512-bit blocks .
Step 3 — Initialise five 32-bit chaining variables:
Step 4 — Process each block (80 rounds):
- Expand the sixteen 32-bit words into eighty words using .
- Set . For to :
where and constant change across four groups of 20 rounds (Ch, Parity, Maj, Parity).
- Add back: (mod ).
Step 5 — Output: After the last block, the 160-bit digest is the concatenation .
Note: SHA-1 is now considered broken for collision resistance (a practical collision was demonstrated in 2017) and is deprecated in favour of SHA-2/SHA-3.
Section B: Short Answer Questions
Attempt any EIGHT questions.
Explain the ElGamal cryptographic system for encryption and decryption.
ElGamal Cryptosystem
A public-key scheme whose security rests on the discrete logarithm problem.
Key generation
- Choose a large prime and a generator of .
- Choose private key with .
- Compute .
- Public key: ; Private key: .
Encryption of message ():
- Pick a random ephemeral with .
- Ciphertext = .
Decryption:
because , so .
Example: . Encrypt with : , . Ciphertext . Decrypt: , inverse of 12 mod 23 is 2, ... (the message is recovered as using exact arithmetic). The scheme is probabilistic (random gives different ciphertexts) but doubles ciphertext size.
Differentiate between block ciphers and stream ciphers. Explain the different modes of operation of block ciphers.
Block vs Stream Ciphers
| Aspect | Block cipher | Stream cipher |
|---|---|---|
| Unit of operation | Fixed-size blocks (e.g. 64/128 bits) | One bit/byte at a time |
| Mechanism | Substitution-permutation on whole block | XOR plaintext with keystream |
| Speed/memory | Slower, more memory | Fast, low memory |
| Error propagation | An error can corrupt the whole block (mode dependent) | Error affects only that bit/byte |
| Examples | DES, AES, Blowfish | RC4, A5/1, ChaCha20 |
Block-Cipher Modes of Operation
- ECB (Electronic Codebook): each block encrypted independently . Simple but identical plaintext blocks give identical ciphertext, leaking patterns. Insecure for large data.
- CBC (Cipher Block Chaining): , with an IV for . Hides patterns; errors propagate to two blocks; not parallelisable for encryption.
- CFB (Cipher Feedback): turns the block cipher into a self-synchronising stream cipher: .
- OFB (Output Feedback): keystream generated independently of plaintext: , . No error propagation.
- CTR (Counter): . Fully parallelisable, random access, widely used.
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 secret key, used to verify both data integrity and authenticity of the sender. The sender computes and sends ; the receiver recomputes the MAC with the shared key and accepts only if the tags match. Unlike a plain hash, an attacker without cannot forge a valid tag. (Note: a MAC gives no non-repudiation, since both parties share .)
HMAC
HMAC (Hash-based MAC, RFC 2104) builds a MAC from any cryptographic hash (e.g. SHA-256):
where:
- is the key padded/hashed to the hash block size,
- repeated, repeated.
The inner hash binds the key to the message; the outer hash wraps the result with the key again. This nested construction makes HMAC resistant to length-extension attacks that affect plain , and its security is provable assuming the underlying hash's compression function is a pseudorandom function. HMAC is used in TLS, IPsec, and JWT signing.
Explain key management and key distribution in symmetric cryptography.
Key Management and Distribution (Symmetric Cryptography)
In symmetric crypto both parties share one secret key, so the central problem is securely distributing and managing that key. For users needing pairwise communication, keys are required — this key-explosion motivates centralised key management.
Key distribution methods
- Manual / physical delivery — keys handed over out-of-band (courier, USB). Secure but not scalable.
- Distribution by a previously shared key — a new session key is encrypted under an existing master key.
- Key Distribution Center (KDC): a trusted server shares a long-term master key with each user. To let A talk to B, the KDC generates a session key and sends it to both, encrypted under their master keys (the basis of Kerberos).
- Public-key-assisted distribution: use Diffie-Hellman or RSA to establish/transport a symmetric session key over an insecure channel.
Key management lifecycle
Generation (strong randomness) → distribution → storage (protected, e.g. HSM) → usage → periodic rotation → revocation → secure destruction. Session keys are short-lived (limit exposure); master keys are long-lived and protect session keys.
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 all .
Example: : , and , so . ✔
It is used for fast modular exponentiation reduction and as the basis of the Fermat primality test.
Euler's Theorem
Statement: If , then
where is Euler's totient (the count of integers in coprime to ).
Euler's theorem generalises Fermat's: when is prime, , recovering Fermat's little theorem.
Example: . (coprimes 1,3,7,9). , , so . ✔
Euler's theorem underpins RSA, where decryption works because .
Is a man-in-the-middle attack possible in the Diffie-Hellman algorithm? Justify your answer.
Is MITM Possible in Diffie-Hellman?
Yes. Plain (unauthenticated) Diffie-Hellman is vulnerable to a man-in-the-middle attack, because the protocol exchanges and without authenticating who sent them.
Justification / how the attack works: An active attacker Mallory positioned between Alice and Bob:
- Intercepts Alice's and instead sends Bob his own .
- Intercepts Bob's and sends Alice his own .
- Now Alice computes (shared with Mallory) and Bob computes (also shared with Mallory).
Mallory thus holds a separate key with each party, decrypting and re-encrypting all traffic undetected. DH only guarantees secrecy against a passive eavesdropper (who faces the discrete-log problem), not an active attacker.
Why and the fix: the weakness is the lack of authentication, not the math. Countermeasures: authenticated DH — sign or certify the exchanged values (Station-to-Station protocol, digital signatures, or PKI certificates) so each side verifies the other's identity.
Explain the families of SHA-2 and their differences from SHA-1.
SHA-2 Family
SHA-2 is a family of hash functions designed by the NSA (2001) that share the same Merkle-Damgård + Davies-Meyer compression structure but differ in word size, digest length and number of rounds:
| Variant | Digest size | Block size | Word size | Rounds |
|---|---|---|---|---|
| SHA-224 | 224 bits | 512 bits | 32-bit | 64 |
| SHA-256 | 256 bits | 512 bits | 32-bit | 64 |
| SHA-384 | 384 bits | 1024 bits | 64-bit | 80 |
| SHA-512 | 512 bits | 1024 bits | 64-bit | 80 |
| SHA-512/224, /256 | 224/256 bits | 1024 bits | 64-bit | 80 |
SHA-224/256 use eight 32-bit chaining variables; SHA-384/512 use eight 64-bit variables. SHA-224 and SHA-384 are truncations with different initial values.
Differences from SHA-1
- Digest length: SHA-1 outputs only 160 bits; SHA-2 offers 224–512 bits → far larger security margin against collisions ( vs ).
- Internal state: SHA-1 uses five 32-bit words; SHA-2 uses eight words and a more complex round function with additional mixing/ functions and more round constants.
- Security: SHA-1 is broken (practical collision found in 2017) and deprecated; SHA-2 remains secure and is widely deployed (TLS, certificates, blockchain).
- Rounds: SHA-1 has 80 rounds on a 160-bit state; SHA-256 has 64 and SHA-512 has 80 rounds on larger states.
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 and standards that manages the creation, distribution, storage and revocation of digital certificates and public keys, enabling trusted use of public-key cryptography over open networks. It answers the core problem: how do I trust that a public key really belongs to a given identity?
Components
- Certificate Authority (CA) — trusted third party that issues and digitally signs certificates.
- Registration Authority (RA) — verifies an applicant's identity before the CA issues a certificate.
- Certificate Repository / Directory and CRL / OCSP for revocation.
- End entities (users, servers) and their key pairs.
Role of the Certificate Authority
The CA vouches for the binding between a public key and an identity. It verifies the applicant, then issues a certificate signed with the CA's private key. Anyone holding the CA's trusted public key can verify the signature, and thus trust the contained public key. The CA also maintains revocation lists.
Digital Certificate
A digital certificate (commonly X.509) is a signed data structure binding a public key to an identity. Key fields: version, serial number, subject name, subject public key, issuer (CA) name, validity period, signature algorithm, and the CA's digital signature. Verifying the CA's signature (and validity/revocation) establishes trust in the subject's public key — the basis of HTTPS/TLS server authentication.
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 categories:
1. Virus
A virus is a code fragment that attaches itself to a host program or file and cannot run on its own. When the infected program executes, the virus runs, replicates by inserting copies into other programs/files, and may deliver a payload (corrupting data, displaying messages). Spread requires user action (running the infected file). Phases: dormant → propagation → triggering → execution.
2. Worm
A worm is a standalone, self-replicating program that spreads automatically across networks without attaching to a host file and without user intervention, typically exploiting vulnerabilities or network services. It consumes bandwidth and resources and can spread explosively (e.g. Morris worm, Conficker). Key difference from a virus: a worm propagates by itself over a network.
3. Trojan Horse
A Trojan disguises itself as legitimate, useful software but performs hidden malicious actions when run — e.g. installing a backdoor, stealing data, or giving remote control. Unlike viruses and worms, a Trojan does not self-replicate; it relies on tricking the user into installing it (social engineering).
| Type | Self-replicating? | Needs host file? | Spread |
|---|---|---|---|
| Virus | Yes | Yes | User runs infected file |
| Worm | Yes | No | Automatic over network |
| Trojan | No | No | User tricked into running it |
Frequently asked questions
- Where can I find the BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) question paper 2077?
- The full BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2077 (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) 2077 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) 2077 paper?
- The BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2077 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.