BSc CSIT (TU) Science Cryptography (BSc CSIT, CSC316) Question Paper 2074 Nepal
This is the official BSc CSIT (TU) (Science stream) Cryptography (BSc CSIT, CSC316) question paper for 2074, 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 2074 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt any TWO questions.
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 (Rivest–Shamir–Adleman) is a public-key (asymmetric) cryptosystem whose security rests on the difficulty of factoring the product of two large primes.
Key Generation
- Choose two large distinct primes and .
- Compute the modulus .
- Compute Euler's totient .
- Choose a public exponent such that and .
- Compute the private exponent such that , i.e. .
- Public key:
- Private key:
Encryption and Decryption
For a plaintext message (with ):
Correctness follows from Euler's theorem: since .
Worked Example ()
- .
- .
- Choose with . Take (since ).
- Find . Solve . Testing, , so .
- Public key:
- Private key:
Encryption of :
Compute by repeated squaring mod 77:
.
Verification (decryption): , recovering the original plaintext.
Note: with another common choice , and . Any valid pair is acceptable provided the computation is consistent.
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 using a 56-bit effective key (64-bit key with 8 parity bits). It is a Feistel cipher with 16 rounds.
Overall Structure (Block Diagram in words)
64-bit Plaintext
|
Initial Permutation (IP)
|
Split into L0 (32) | R0 (32)
|
Round 1 (uses subkey K1)
Round 2 (uses subkey K2)
...
Round 16 (uses subkey K16)
|
32-bit Swap (L16, R16 -> R16, L16)
|
Inverse Initial Permutation (IP^-1)
|
64-bit Ciphertext
A separate key schedule takes the 64-bit key, applies Permuted Choice 1 (PC-1, drops parity to 56 bits), splits into two 28-bit halves, performs left circular shifts each round, and applies Permuted Choice 2 (PC-2) to produce a 48-bit subkey for each round.
A Single Round (Feistel structure)
Each round splits the 64-bit block into left and right halves (32 bits each) and computes:
Thus only the right half passes through the function ; the halves swap each round (the final round omits the swap via the 32-bit swap at the end).
The Function F (the heart of DES)
takes a 32-bit input and a 48-bit subkey :
- Expansion (E): The 32-bit is expanded to 48 bits by the expansion permutation (duplicating some bits).
- Key mixing: XOR the 48-bit expanded value with the 48-bit subkey .
- Substitution (S-boxes): The 48-bit result is split into eight 6-bit groups; each is fed to one of eight S-boxes, each mapping 6 bits to 4 bits. The S-boxes provide the cipher's non-linearity (confusion) and are the only non-linear component. Output is bits.
- Permutation (P): The 32-bit S-box output is permuted by the P-box (diffusion).
The 32-bit result of is XORed with to form .
Decryption
DES decryption uses the same algorithm with the subkeys applied in reverse order ( first, last) — a key advantage of the Feistel structure.
DES is now considered insecure due to its short 56-bit key (brute-forceable); 3DES and AES are its successors.
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 (Rijndael) that encrypts 128-bit blocks using key sizes of 128, 192 or 256 bits, with 10, 12 or 14 rounds respectively. Unlike DES it is not a Feistel cipher; it is a substitution–permutation network operating on a matrix of bytes called the state.
Overall Structure
Plaintext (128 bits) -> State (4x4 bytes)
AddRoundKey (initial)
Rounds 1..(Nr-1): SubBytes -> ShiftRows -> MixColumns -> AddRoundKey
Final round Nr: SubBytes -> ShiftRows -> AddRoundKey (no MixColumns)
-> Ciphertext (128 bits)
Round keys are derived from the cipher key by the key expansion (key schedule). Operations are performed in the finite field with the irreducible polynomial .
The Four Transformations
1. SubBytes (byte substitution – confusion)
Each byte of the state is replaced using a fixed 16×16 lookup table, the S-box, which is the multiplicative inverse in followed by an affine transform. Example: byte 0x53 is replaced by 0xED from the S-box. This is the only non-linear step.
2. ShiftRows (permutation – diffusion across columns) Rows of the state are cyclically shifted left: row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 bytes. Example: a row in row 1 becomes .
3. MixColumns (diffusion within columns) Each column is treated as a polynomial over and multiplied (modulo ) by the fixed matrix:
Example: output byte , where multiplication is in . (Skipped in the final round.)
4. AddRoundKey (key mixing)
The 128-bit state is XORed byte-by-byte with the 128-bit round key derived from key expansion. Example: state byte 0x53 XOR round-key byte 0xA6 = 0xF5.
Decryption
Uses the inverse transformations (InvSubBytes, InvShiftRows, InvMixColumns) with round keys applied in reverse order. AES combines confusion (SubBytes) and diffusion (ShiftRows + MixColumns) and is the current global encryption standard.
Section B: Short Answer Questions
Attempt any EIGHT questions.
Explain the goals of security: confidentiality, integrity and availability. List the different types of security attacks.
Goals of Security (CIA Triad)
- Confidentiality: Ensures that information is accessible only to authorized parties and protected from disclosure to unauthorized users. Achieved mainly through encryption and access control.
- Integrity: Ensures that information is not altered, modified, or destroyed by unauthorized parties; data received is exactly what was sent. Achieved through hashing, MACs and digital signatures.
- Availability: Ensures that systems, services and data are accessible to authorized users whenever needed. Threatened by denial-of-service (DoS) attacks; protected by redundancy and backups.
Types of Security Attacks
Attacks are broadly classified as passive and active:
Passive attacks (eavesdropping, hard to detect):
- Release of message contents (interception/eavesdropping)
- Traffic analysis (studying patterns of communication)
Active attacks (modify the data stream, easier to detect but harder to prevent):
- Masquerade (one entity pretends to be another)
- Replay (capturing and retransmitting data)
- Modification of messages
- Denial of service (DoS)
These can also be described as interruption (availability), interception (confidentiality), modification (integrity) and fabrication (authenticity).
Differentiate between symmetric and asymmetric key cryptography with examples.
Symmetric vs Asymmetric Key Cryptography
| Aspect | Symmetric Key | Asymmetric Key |
|---|---|---|
| Keys used | Single shared secret key for both encryption and decryption | Key pair: public key (encrypt) and private key (decrypt) |
| Key relation | Same key on both sides | Mathematically related but distinct keys |
| Speed | Fast, efficient for bulk data | Slow, computationally expensive |
| Key distribution | Difficult — the secret key must be shared securely | Easier — public key can be shared openly |
| Number of keys for users | keys | keys (one pair per user) |
| Main use | Confidentiality of large data | Key exchange, digital signatures |
| Examples | DES, 3DES, AES, RC4, Blowfish | RSA, ElGamal, Diffie–Hellman, ECC |
Summary
- Symmetric cryptography is fast but suffers from the key-distribution problem.
- Asymmetric cryptography solves key distribution and enables digital signatures but is slow.
- In practice both are combined (hybrid cryptography): asymmetric crypto securely exchanges a symmetric session key, which then encrypts the bulk data (e.g. TLS/SSL).
Explain the Caesar cipher and the mono-alphabetic substitution cipher with examples of their cryptanalysis.
Caesar Cipher
The Caesar cipher is a monoalphabetic substitution cipher that shifts each letter by a fixed amount (the key, classically ).
Example (): plaintext HELLO → ciphertext KHOOR.
Cryptanalysis: Trivially broken by brute force — there are only 25 possible non-trivial keys, so an attacker tries all shifts until meaningful text appears.
Monoalphabetic Substitution Cipher
Each plaintext letter is mapped to a fixed but arbitrary ciphertext letter (a permutation of the alphabet), giving possible keys — far too many for brute force.
Example: a key mapping A→Q, B→W, C→E, ... ; CAB → EQW.
Cryptanalysis: Although brute force is infeasible, it is easily broken by frequency analysis. Each plaintext letter always maps to the same ciphertext letter, so the statistical frequency of letters is preserved. In English, E is most frequent (~12.7%), followed by T, A, O. The attacker matches the most frequent ciphertext letters to common plaintext letters, and uses digraphs (TH, ER), common words and patterns to recover the rest of the mapping.
Conclusion
Both ciphers fail because they are monoalphabetic: the Caesar cipher to brute force, and the general substitution cipher to frequency analysis. Polyalphabetic ciphers (e.g. Vigenère) were developed to defeat frequency analysis.
Explain modular arithmetic and Euler's totient function. Compute phi(35) and phi(24).
Modular Arithmetic
Modular arithmetic deals with integers and a fixed modulus : two integers and are congruent modulo if they leave the same remainder on division by , written
The result of any operation is reduced to the set (). It is fundamental to cryptography (RSA, ElGamal, Diffie–Hellman) because operations are bounded and one-way functions (e.g. modular exponentiation) are easy to compute but hard to invert. Example: , and .
Euler's Totient Function
counts the positive integers that are coprime to (i.e. ).
Properties:
- For a prime : .
- For a prime power: .
- Multiplicative: if then .
Compute
(both prime, coprime):
Compute
:
Alternatively
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
- Choose a large prime and a primitive root (generator) of .
- Choose a private key with .
- Compute the public value .
- Public key:
- Private key:
Encryption (sender, to encrypt message where )
- Choose a random ephemeral key with , .
- Compute the two ciphertext components:
The ciphertext is the pair .
Decryption (receiver, using private key )
This works because , so dividing by recovers .
Example (small numbers)
Let , , private ⇒ . To send with random :
- .
Decrypt: , inverse of 4 mod 11 is 3, so . ✓
Notes
- A fresh random must be used for each message (reuse breaks security).
- The ciphertext is twice the size of the plaintext (message expansion).
Differentiate between block ciphers and stream ciphers. Explain the different modes of operation of block ciphers.
Block Ciphers vs Stream Ciphers
| Aspect | Block Cipher | Stream Cipher |
|---|---|---|
| Unit of processing | Fixed-size blocks (e.g. 64 or 128 bits) | One bit/byte at a time |
| Mechanism | Substitution–permutation / Feistel rounds | Plaintext XORed with a pseudorandom keystream |
| Speed/latency | Slower per block, needs full block | Fast, low latency, suited for real-time streams |
| Error propagation | Errors may spread within a block (mode-dependent) | A bit error affects only that bit |
| Examples | DES, 3DES, AES, Blowfish | RC4, A5/1, ChaCha20 |
Block ciphers are more common for stored/bulk data; stream ciphers suit continuous communication.
Modes of Operation of Block Ciphers
Modes let a block cipher encrypt messages longer than one block:
- ECB (Electronic Codebook): Each block encrypted independently, . Simple but insecure — identical plaintext blocks give identical ciphertext, revealing patterns.
- CBC (Cipher Block Chaining): Each plaintext block is XORed with the previous ciphertext block before encryption: , with . Hides patterns; sequential.
- CFB (Cipher Feedback): Turns the block cipher into a self-synchronizing stream cipher: .
- OFB (Output Feedback): Generates a keystream independent of plaintext: , . Errors do not propagate.
- CTR (Counter): Encrypts an incrementing counter to form a keystream: . Parallelizable and random-access; widely used.
A random/unique Initialization Vector (IV) is required for CBC, CFB, OFB and a nonce for CTR.
What is a Message Authentication Code (MAC)? Explain how HMAC works.
Message Authentication Code (MAC)
A MAC is a small fixed-size tag generated from a message and a shared secret key that provides data integrity and authentication of the message source. The sender computes and appends it; the receiver recomputes it with the same key and accepts the message only if the values match.
- Provides: integrity (detects tampering) and authentication (only a holder of could produce a valid tag).
- Unlike a digital signature it uses a symmetric key, so it does not provide non-repudiation.
- A MAC differs from a plain hash because it depends on a secret key — an attacker cannot forge it without .
HMAC (Hash-based MAC)
HMAC constructs a MAC from a cryptographic hash function (e.g. SHA-256) and a secret key :
where:
- = key padded with zeros to the hash block size,
- = the byte
0x36repeated, = the byte0x5Crepeated, - denotes concatenation.
How it works (steps)
- Pad/format the key to block length, producing .
- XOR with and prepend it to the message; hash → inner hash.
- XOR with , prepend it to the inner hash; hash again → HMAC value.
The nested (two-pass) structure protects against length-extension attacks. HMAC is provably secure if the underlying hash is reasonably strong and is widely used in TLS, IPSec and API authentication.
Explain key management and key distribution in symmetric cryptography.
Key Management and Key Distribution in Symmetric Cryptography
The Problem
In symmetric cryptography both parties share one secret key. The central challenge is distributing that key securely so an eavesdropper never obtains it. For users wanting pairwise communication, keys are needed — this scales poorly.
Key Distribution Options
For parties A and B, a key can be delivered by:
- A physically selects the key and hands it to B (manual/out-of-band).
- A trusted third party selects and delivers it to both.
- If A and B already share a key, one can encrypt and send a new (session) key.
- Via a Key Distribution Center (KDC) that shares a long-term master key with each user.
KDC-based Distribution (typical approach)
- Each user shares a permanent master key with the KDC.
- When A wants to talk to B, A requests a session key from the KDC.
- The KDC generates a one-time session key and sends it to A (encrypted with A's master key) and to B (encrypted with B's master key, often forwarded by A as a ticket).
- A and B then use the session key for that session only, then discard it.
- Kerberos is a well-known KDC-based protocol.
Key Management Lifecycle
Key management covers the full lifecycle: generation (strong random keys), distribution/exchange (KDC or Diffie–Hellman), storage (protected, e.g. in HSMs), use, rotation/renewal, and revocation/destruction. Using session keys (short-lived) plus master keys (long-lived) limits exposure if a key is compromised.
Note
Asymmetric techniques such as Diffie–Hellman key exchange are often used to establish a symmetric key over an insecure channel without a pre-shared secret.
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 not divisible by (i.e. ), then
Equivalently, for any integer : .
Use: primality testing (Fermat test), and computing modular inverses ().
Example: Let , . Then . Since , we get . ✓
Euler's Theorem
Statement: Euler's theorem generalizes Fermat's to any modulus . If , then
where is Euler's totient function. When is prime, and this reduces exactly to Fermat's little theorem.
Use: It is the mathematical foundation of RSA decryption ( because ).
Example: Let , . Then . So . Since , . ✓
Relationship
Euler's theorem is the general case; Fermat's little theorem is the special case for a prime modulus.
Frequently asked questions
- Where can I find the BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) question paper 2074?
- The full BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2074 (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) 2074 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) 2074 paper?
- The BSc CSIT (TU) Cryptography (BSc CSIT, CSC316) 2074 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.