Cryptography Basics MCQs for the NSCT
Cryptography basics covers how data is kept secret and tamper-evident: symmetric ciphers such as AES, public-key algorithms such as RSA and Diffie-Hellman, hash functions and digital signatures, plus the classical ciphers used to teach them. It is topic 3 of the 16 in the Cyber Security area, which carries 5% of the NSCT according to HEC's Areas of Competencies. Candidates averaged 47.2% accuracy in this area in 2026, per the HEC NSCT report and APP.
Everything here follows Stallings, Cryptography and Network Security. Expect small calculations: shift a few letters, find an RSA key or count keys.
Symmetric vs asymmetric
Symmetric (conventional) encryption uses one shared secret key for both directions. Asymmetric (public-key) encryption uses a key pair: a public key anyone may know and a private key only the owner holds.
| Symmetric | Asymmetric | |
|---|---|---|
| Keys | One shared secret | Public + private pair |
| Examples | DES (56-bit key, 64-bit block), 3DES, AES (128-bit block; 128/192/256-bit key) | RSA, Diffie-Hellman, ECC |
| Speed | Fast, used for bulk data | Much slower |
| Keys for n users | n(n − 1)/2 | n key pairs |
| Main problem | Distributing keys | Trusting that a public key is genuine |
For 50 users, symmetric needs 50 × 49 / 2 = 1,225 keys, against 50 key pairs. Real systems such as TLS are hybrid: public-key methods set up a session key, and AES encrypts the data.
Classical ciphers show the basics. A Caesar shift of 5 turns NSCT into SXHY, and only 25 useful keys exist. A general monoalphabetic substitution has 26! ≈ 4 × 10^26 keys but falls to frequency analysis. Vigenère uses a repeating keyword, so the same letter can encrypt differently.
Key space and brute force: a k-bit key has 2^k keys, and on average half must be tried. At 10^9 keys per second, DES's 2^55 average takes about 1.1 years; at 10^13 per second it takes about an hour. AES-128 stays out of reach.
RSA in five steps (toy numbers): p = 5, q = 13, so n = 65 and φ(n) = 4 × 12 = 48. Choose e = 5, coprime with 48. Then d = 5^−1 mod 48 = 29, because 5 × 29 = 145 = 3 × 48 + 1. Encrypt m = 2: C = 2^5 mod 65 = 32. Decrypt: 32^29 mod 65 = 2.
Diffie-Hellman (p = 11, g = 2): Alice picks 3 and sends 2^3 mod 11 = 8; Bob picks 4 and sends 2^4 mod 11 = 5. Both reach 4 (5^3 mod 11 = 8^4 mod 11 = 4). Unauthenticated DH is open to man-in-the-middle attacks.
Exam angle: for confidentiality, encrypt with the receiver's public key; for a signature, use the sender's private key.
Hashing
A cryptographic hash maps any input to a fixed-length digest. It needs three properties:
- Pre-image resistance (one-way): given h, finding x with H(x) = h is infeasible.
- Second pre-image resistance: given x, finding another y with the same hash is infeasible.
- Collision resistance: finding any pair x ≠ y with H(x) = H(y) is infeasible. The birthday attack needs about 2^(n/2) tries.
| Hash | Output bits | Hex characters | Status |
|---|---|---|---|
| MD5 | 128 | 32 | Collisions practical, do not use |
| SHA-1 | 160 | 40 | Collisions shown (2017), deprecated |
| SHA-256 | 256 | 64 | Secure |
| SHA-512 | 512 | 128 | Secure |
Hashing is not encryption: there is no key and no decryption. For passwords, add a unique salt and use a slow function such as bcrypt or Argon2. A MAC such as HMAC adds a shared key, giving integrity and authentication but not non-repudiation.
Exam angle: digest length never depends on input length.
Digital signatures
To sign, the sender hashes the message and transforms the hash with their private key. The receiver recomputes the hash and checks the signature with the sender's public key. A signature gives origin authentication, integrity and non-repudiation, but not confidentiality.
To both sign and hide a message, sign with your private key, then encrypt with the receiver's public key. X.509 certificates, signed by a certificate authority (CA) with the CA's private key, tie a public key to an identity, which solves the "is this really Bob's key?" problem.
Exam angle: a broken hash breaks signatures too, because the signature covers only the hash.
Common traps
- Using φ(n) wrongly: d is the inverse of e mod φ(n), not mod n.
- Signing with the receiver's public key, or encrypting secrets with your own private key.
- Thinking a huge key space alone makes a cipher secure.
- Calling hashing "one-way encryption" that can be decrypted with a key.
- Counting n² or n(n − 1) symmetric keys instead of n(n − 1)/2.
- Assuming MACs give non-repudiation.
Worked examples
1. Understanding. Which key verifies a digital signature made by Sara? Answer: Sara's public key. Only her private key could have created the signature, and anyone can check it with her public key.
2. Application. Toy RSA: p = 5, q = 11, e = 3. Find d and encrypt m = 9. Answer: n = 55 and φ(n) = 40. d = 27, because 3 × 27 = 81 ≡ 1 (mod 40). C = 9^3 mod 55 = 729 mod 55 = 14.
3. Analysis. A site stores unsalted SHA-256 password hashes, and two users show the same hash. What does that reveal, and what is the fix? Answer: they almost certainly share a password, and the hashes are open to precomputed tables. Add a unique salt per user and switch to bcrypt or Argon2.
Practise
The quiz below has 100 questions on cryptography basics, filterable by tier and difficulty. For a longer comparison, see symmetric vs asymmetric encryption.
Practise: 100 questions
FAQs
Is hashing the same as encryption?
No. Encryption is reversible with the right key and protects data you need to read again. Hashing has no key, cannot be reversed and always gives a fixed-length output. It is used to check integrity, to build signatures and MACs, and, with salt and a slow algorithm, to store passwords.
Why is RSA not used to encrypt whole files?
RSA is far slower than AES, and one RSA-2048 operation can carry less than 256 bytes. Systems therefore use hybrid encryption: RSA or Diffie-Hellman protects a random session key, and AES encrypts the actual file or traffic.
Do I need to memorise RSA calculations for the NSCT?
Learn the steps rather than numbers: n = pq, φ(n) = (p − 1)(q − 1), choose e coprime with φ(n), find d as e's inverse mod φ(n), then C = m^e mod n and m = C^d mod n. Practise with primes under 20 so every step is quick by hand.
Next step
Continue to Network Security MCQs, the next topic in the official order, where TLS, VPNs and IPsec put these primitives to work. Revisit the Cyber Security MCQs hub or test yourself in an NSCT mock test.