BSc CSIT (TU) Science Cryptography (BSc CSIT, CSC316) Question Paper 2075 Nepal
This is the official BSc CSIT (TU) (Science stream) Cryptography (BSc CSIT, CSC316) question paper for 2075, 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 2075 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 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-key block cipher that encrypts a 64-bit plaintext block using a 56-bit key (supplied as 64 bits, with 8 parity bits) and produces a 64-bit ciphertext. It is based on a Feistel structure with 16 rounds.
Overall Structure (Block Diagram in words)
64-bit Plaintext
|
[ Initial Permutation (IP) ]
|
split into L0 (32 bits) | R0 (32 bits)
|
Round 1 (uses subkey K1)
Round 2 (uses subkey K2)
...
Round 16 (uses subkey K16)
|
swap (R16 | L16) -> 32+32 = 64 bits
|
[ Inverse Initial Permutation (IP^-1) ]
|
64-bit Ciphertext
The 56-bit key is processed by a key schedule: it is passed through Permuted Choice 1 (PC-1), split into two 28-bit halves, circularly left-shifted each round, and compressed by Permuted Choice 2 (PC-2) into a 48-bit round subkey .
A Single Round of DES
DES uses the Feistel structure. For round , the input is transformed as:
The right half is fed to the round function , the result is XORed with the left half, and the halves are swapped.
The Function F (the heart of DES)
F takes the 32-bit and the 48-bit subkey and returns 32 bits:
- Expansion (E): the 32-bit right half is expanded to 48 bits by the expansion permutation E (some bits are duplicated).
- Key mixing (XOR): the 48-bit expanded value is XORed with the 48-bit subkey .
- Substitution (S-boxes): the 48 bits are split into eight 6-bit groups; each group enters an S-box that maps 6 bits to 4 bits (non-linear, provides confusion), giving bits.
- Permutation (P): the 32-bit S-box output is permuted by the P-box (provides diffusion), producing the 32-bit output of F.
The S-boxes are the only non-linear component and are crucial to DES security.
Decryption
Decryption uses the same algorithm with subkeys applied in reverse order (), a property of the Feistel network.
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 block cipher that operates on 128-bit blocks with key sizes of 128, 192, or 256 bits, using 10, 12, or 14 rounds respectively. Unlike DES, AES is not a Feistel cipher; it is a substitution-permutation network (SPN).
The 128-bit block is arranged as a 4x4 matrix of bytes called the State, filled column by column. All arithmetic is done in the finite field with the irreducible polynomial .
Structure (for AES-128, 10 rounds)
AddRoundKey (initial)
Rounds 1..9: SubBytes -> ShiftRows -> MixColumns -> AddRoundKey
Round 10: SubBytes -> ShiftRows -> AddRoundKey (NO MixColumns)
The Four Transformations
1. SubBytes (substitution / confusion)
Each byte of the State is replaced using a fixed S-box (a non-linear byte substitution = multiplicative inverse in followed by an affine transform).
Example: the byte 0x53 is replaced by 0xED according to the S-box lookup.
2. ShiftRows (permutation / diffusion) The rows of the State are cyclically shifted left:
- Row 0: no shift
- Row 1: shift left by 1
- Row 2: shift left by 2
- Row 3: shift left by 3
Example: row [b0 b1 b2 b3] becomes [b1 b2 b3 b0] (1-byte shift).
3. MixColumns (diffusion) Each column is treated as a polynomial over and multiplied (mod ) by the fixed matrix:
Multiplication is in and addition is XOR. This spreads each input byte across all four output bytes of the column. (Omitted in the final round.)
4. AddRoundKey The 128-bit round key (derived from the cipher key by the key expansion / key schedule) is XORed byte-by-byte with the State:
Decryption
Decryption applies the inverse transformations (InvSubBytes, InvShiftRows, InvMixColumns, AddRoundKey) 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 (DH) lets two parties establish a shared secret key over an insecure channel without prior secrets. Its security rests on the Discrete Logarithm Problem: it is easy to compute but hard to recover from it.
Algorithm
Public parameters: a large prime and a primitive root (generator) of .
- Alice picks a private , computes , sends to Bob.
- Bob picks a private , computes , sends to Alice.
- Alice computes .
- Bob computes .
Both obtain the same key because:
Numerical Example
Let , .
- Alice: private , .
- Bob: private , .
- Alice: .
- Bob: .
Shared secret . An eavesdropper sees but cannot easily find or .
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 --A=g^a--> Mallory --M1=g^m--> Bob
Alice <--M2=g^n-- Mallory <--B=g^b--- Bob
- Alice sends ; Mallory intercepts it and sends her own to Bob.
- Bob sends ; Mallory intercepts it and sends her own to Alice.
- Alice computes (shared with Mallory).
- Bob computes (shared with Mallory).
Now Mallory shares key with Alice and with Bob. She decrypts every message from one side, reads/alters it, re-encrypts with the other key, and forwards it. Neither party detects the attack.
Countermeasure: authenticate the exchanged values (e.g. signed/certified public values, station-to-station protocol, or DH within TLS with certificates).
Section B: Short Answer Questions
Attempt any EIGHT questions.
Explain the Caesar cipher and the mono-alphabetic substitution cipher with examples of their cryptanalysis.
Caesar Cipher
The Caesar cipher is a mono-alphabetic shift substitution: each letter is shifted by a fixed key .
Example (): HELLO -> KHOOR.
Cryptanalysis: the key space has only 25 possibilities, so a brute-force attack trying all shifts breaks it instantly; alternatively frequency analysis on a single letter reveals the shift.
Mono-alphabetic Substitution Cipher
Here each plaintext letter maps to an arbitrary fixed letter, giving a key space of permutations, so brute force is infeasible.
Cryptanalysis (frequency analysis): the cipher preserves letter frequencies. In English, E (~12.7%), T, A, O are most common. By matching the most frequent ciphertext letters to common English letters and using digram/trigram patterns (e.g. TH, THE), the substitution table is recovered. Example: if X is the most frequent ciphertext letter, it likely maps to E.
Conclusion: both are insecure - Caesar by brute force, mono-alphabetic by frequency analysis.
Explain modular arithmetic and Euler's totient function. Compute phi(35) and phi(24).
Modular Arithmetic
Modular arithmetic is arithmetic over the integers where numbers wrap around after reaching a modulus . We write if divides , i.e. they leave the same remainder when divided by . Example: . It underlies almost all modern public-key cryptography (RSA, Diffie-Hellman, ElGamal).
Euler's Totient Function
counts the integers in that are coprime to (i.e. ).
Properties used for computation:
- If is prime, .
- is multiplicative: if , .
- For , .
Compute
(both prime, coprime):
Compute
:
(The 8 numbers coprime to 24 are 1, 5, 7, 11, 13, 17, 19, 23.)
Explain the ElGamal cryptographic system for encryption and decryption.
ElGamal Cryptosystem
ElGamal is a public-key (asymmetric) encryption scheme whose security is based on the Discrete Logarithm Problem. It is probabilistic (the same plaintext encrypts to different ciphertexts).
Key Generation
- Choose a large prime and a generator of .
- Choose a private key with .
- Compute the public value .
- Public key: Private key: .
Encryption (of message , where )
- Pick a random ephemeral with .
- Compute .
- Compute .
- Ciphertext: .
Decryption
Using private key :
This works because , so .
Small Example
Let , , private . To encrypt with : , . Ciphertext . Decrypt: , inverse of 4 mod 11 is 3, so .
Note: a fresh random must be used for every message; reusing leaks the plaintext.
Differentiate between block ciphers and stream ciphers. Explain the different modes of operation of block ciphers.
Block Ciphers vs Stream Ciphers
| Feature | Block Cipher | Stream Cipher |
|---|---|---|
| Unit of operation | Fixed-size blocks (e.g. 64/128 bits) | One bit/byte at a time |
| Method | Substitution-permutation over a block | XOR plaintext with a keystream |
| Speed/latency | Slower, needs full block | Fast, low latency |
| Error propagation | Higher (depends on mode) | Limited to affected bit(s) |
| Examples | DES, 3DES, AES | RC4, A5/1, ChaCha20 |
Modes of Operation of Block Ciphers
Modes let a block cipher securely encrypt messages longer than one block.
- ECB (Electronic Codebook): each block encrypted independently, . Simple but identical plaintext blocks give identical ciphertext, leaking patterns - not secure for structured data.
- CBC (Cipher Block Chaining): with an IV for . Identical blocks encrypt differently; errors propagate to two blocks. Encryption is sequential.
- CFB (Cipher Feedback): turns the block cipher into a self-synchronizing stream cipher; .
- OFB (Output Feedback): generates a keystream by repeatedly encrypting the IV (, ); no error propagation, but no self-synchronization.
- CTR (Counter): encrypts an incrementing counter to form a keystream, . Parallelizable and 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 shared secret key that provides data integrity and authentication of origin. The sender computes and sends ; the receiver recomputes the MAC and accepts only if the tags match. Anyone without cannot forge a valid tag. (Unlike a digital signature, a MAC uses a symmetric key, so it does not provide non-repudiation.)
HMAC (Hash-based MAC)
HMAC builds a MAC from a cryptographic hash function (e.g. SHA-256) and a key :
where:
- is the key padded/hashed to the hash block size.
- ipad = the byte
0x36repeated; opad = the byte0x5Crepeated. - denotes concatenation.
How it works: the inner hash mixes the (ipad-keyed) value with the message; the outer hash re-keys the result with opad. The nested two-pass construction protects against length-extension attacks that affect plain . HMAC is provably secure as long as the underlying hash's compression function is a good PRF, and is used in TLS, IPsec and JWT.
Explain key management and key distribution in symmetric cryptography.
Key Management and Distribution in Symmetric Cryptography
Key management covers the full life cycle of secret keys: generation, distribution, storage, use, update/rotation, and destruction. In symmetric cryptography both parties share the same secret key, so securely delivering that key is the central challenge.
The Key Distribution Problem
For users who all wish to communicate pairwise, distinct keys are needed, which scales poorly. Keys must reach both parties without exposure to attackers.
Distribution Methods
- Manual / physical delivery: key handed over out-of-band (courier, smart card). Secure but not scalable.
- Key encrypting key (KEK): a previously shared master key is used to encrypt and transmit fresh session keys.
- Key Distribution Center (KDC): a trusted server shares a long-term key with each user and issues short-lived session keys on demand (basis of Kerberos). Reduces the number of long-term keys to .
- Public-key assisted exchange: use Diffie-Hellman or encrypt the symmetric key under the recipient's public key, then communicate symmetrically.
Good Practice
- Use session keys (short-lived) rather than reusing one key, limiting exposure.
- Protect keys in storage (HSMs, key vaults); rotate and revoke keys; destroy expired keys securely.
State and explain Fermat's little theorem and Euler's theorem with examples.
Fermat's Little Theorem
Statement: If is a prime and is an integer with , then
Equivalently, for any integer .
Use: primality testing and computing modular inverses ().
Example: , : , so . ✓
Euler's Theorem
Statement (generalisation of Fermat's): If , then
where is Euler's totient function. When is prime, and this reduces to Fermat's little theorem.
Use: it is the basis of the RSA correctness proof and of modular exponentiation reduction.
Example: , , : , so . ✓
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 provides no authentication of the exchanged public values, so an active attacker (Mallory) positioned between the two parties can mount a man-in-the-middle attack.
Justification
Alice and Bob exchange and over the channel, but neither can verify who actually sent the value they received. Mallory intercepts and substitutes her own values:
- Alice -> Mallory: . Mallory sends Bob instead.
- Bob -> Mallory: . Mallory sends Alice instead.
- Alice computes (shared with Mallory, not Bob).
- Bob computes (shared with Mallory, not Alice).
Mallory now shares a separate key with each party, so she can decrypt, read, modify and re-encrypt all traffic transparently. The DLP-hardness of DH does not help, because Mallory never needs to solve a discrete log - she simply uses her own private values.
Why it works / countermeasure
The vulnerability exists only because the public values are unauthenticated. It is prevented by authenticating the exchange: signed/certified public keys, the Station-to-Station (STS) protocol, or running DH inside an authenticated channel (e.g. TLS with certificates).
Explain the families of SHA-2 and their differences from SHA-1.
SHA-2 Family
SHA-2 is a family of cryptographic hash functions designed by the NSA and standardised by NIST (FIPS 180-4). It is built on the Merkle-Damgard construction with a Davies-Meyer compression function and uses modular addition, logical functions, rotations and round constants.
Members of SHA-2
| Variant | Output (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, SHA-512/256 | 224 / 256 | 1024 | 64-bit | 80 |
SHA-224/256 share one algorithm (different IVs and truncation); SHA-384/512 share another (64-bit words, larger blocks).
Differences from SHA-1
| Aspect | SHA-1 | SHA-2 |
|---|---|---|
| Digest size | 160 bits (fixed) | 224 / 256 / 384 / 512 bits |
| Rounds | 80 | 64 (256) / 80 (512) |
| Internal state | 5 x 32-bit words | 8 x 32-bit (or 64-bit) words |
| Security | Broken - practical collisions found (SHAttered, 2017) | No practical collision attack; considered secure |
| Word/block options | 32-bit / 512-bit only | 32-bit & 64-bit variants |
Summary: SHA-2 offers larger and selectable digest sizes, a stronger internal structure (8 working variables, more complex message schedule), and far greater collision/preimage resistance, whereas SHA-1's 160-bit output is now considered cryptographically broken and deprecated.
Frequently asked questions
- Where can I find the BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) question paper 2075?
- The full BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2075 (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) 2075 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) 2075 paper?
- The BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2075 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.