CYS401 · Chapter 5 · Annotated SlidesCryptography
Original
Overview

Cryptography

Terminology and Kerckhoffs’s principle, how ciphers are classified, the classical ciphers you must compute by hand (Caesar, keyword, Playfair, Vigenère, one-time pad, Hill, columnar transposition), block ciphers and padding, DES/3DES/AES, the modes (ECB, CBC, CFB, OFB, CTR) and the attacks. Every major exam had a cipher, a padding count and a modes figure from this deck.

How to read this page

Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.

All 68 slides
  1. 1 Cryptography
  2. 2 What is Encryption/Decription?
  3. 3 Cryptography
  4. 4 Encryption in a nutshell
  5. 5 Basic Concepts
  6. 6 Some Basic Terminology
  7. 7 Basic Concepts
  8. 8 Basic Concepts
  9. 9 Kerckhoffs's principle in cryptography
  10. 10 Classifying Cryptographic Systems
  11. 11 Classifying Cryptographic Systems
  12. 12 Cipher Classification
  13. 13 Cryptosystem Types
  14. 14 Figure 5.1
  15. 15 If P is the plaintext, C is the ciphertext, and K is the key,
  16. 16 Figure 3.2
  17. 17 Symmetric Cryptosystem Characteristics
  18. 18 Substitution Ciphers: Caesar Cipher
  19. 19 Caesar Cipher
  20. 20 Caesar Cipher
  21. 21 Substitution Ciphers: ROT13
  22. 22 Substitution Ciphers : Keyword Ciphers
  23. 23 Examples
  24. 24 Examples
  25. 25 Playfair Cipher
  26. 26 Playfair Key Matrix
  27. 27 Encrypting and Decrypting
  28. 28 Playfair Encryption and Decryption
  29. 29 Security of Playfair Cipher
  30. 30 Vigenère Cipher (Encryption)
  31. 31 Vigenère Cipher (Decryption)
  32. 32 How to attack substitution: Frequency Analysis
  33. 33 Substitution Ciphers: One-Time Pads
  34. 34 Example
  35. 35 Substitution Ciphers: Hill Cipher
  36. 36 Slide 36
  37. 37 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  38. 38 ◼
  39. 39 How to find the inverse key matrix
  40. 40 Transposition Cipher
  41. 41 Transposition Cipher
  42. 42 Example
  43. 43 Example
  44. 44 Example
  45. 45 Example
  46. 46 MODERN BLOCK CIPHERS
  47. 47 A modern block cipher
  48. 48 Block Ciphers
  49. 49 Block Ciphers
  50. 50 Padding
  51. 51 Padding
  52. 52 Block Ciphers in Practice
  53. 53 Block Ciphers in Practice
  54. 54 Triple DES
  55. 55 Block Ciphers in Practice
  56. 56 Block Cipher Modes
  57. 57 Cipher Block Chaining (CBC) Mode
  58. 58 Cipher Feedback (CFB) Mode
  59. 59 Output Feedback (OFB) Mode
  60. 60 Counter (CTR) Mode
  61. 61 ATTACKING CONVENTIONAL ENCRYPTION SCHEMES
  62. 62 1. Cryptanalysis
  63. 63 Ciphertext only Attack
  64. 64 Known Plaintext Attack
  65. 65 Chosen Plaintext Attack
  66. 66 Chosen Ciphertext Attack
  67. 67 2. Brute Force Search
  68. 68 Slide 68
Slide 1 / 68

Cryptography

Slide 1: Cryptography

Notes

  1. Tip Hand-cipher rules: CAESAR C = (P + k) mod 26 · VIGENÈRE add the repeated key letter (subtract to decrypt) · PLAYFAIR pairs: same row → right, same column → below, rectangle → own row, other letter’s column; X between doubles · HILL row vector × K mod 26, decrypt with K⁻¹ (det must be coprime with 26) · TRANSPOSITION write in rows, read columns in key order.

Slide 2 / 68

What is Encryption/Decription?

Slide 2: What is Encryption/Decription?

Notes

  1. Encryption/decryption → foundations → classical ciphers → block ciphers → modes → attacks.

Slide 3 / 68

Cryptography

Slide 3: Cryptography
Slide 4 / 68

Encryption in a nutshell

Slide 4: Encryption in a nutshell

Notes

  1. Encryption in a nutshell: plaintext + key → ciphertext → (key) → plaintext.

Slide 5 / 68

Basic Concepts

Slide 5: Basic Concepts
Slide 6 / 68

Some Basic Terminology

Slide 6: Some Basic Terminology
Slide 7 / 68

Basic Concepts

Slide 7: Basic Concepts

Notes

  1. Notation: C = E_K(P), P = D_K(C).

Slide 8 / 68

Basic Concepts

Slide 8: Basic Concepts

Exam angle

PredictionQ1

Cryptography can protect availability.

Slide 9 / 68

Kerckhoffs's principle in cryptography

Slide 9: Kerckhoffs's principle in cryptography

Exam angle

PredictionQ1

Kerckhoffs’s principle says the security of a cryptosystem should depend only on:

Slide 10 / 68

Classifying Cryptographic Systems

Slide 10: Classifying Cryptographic Systems
Slide 11 / 68

Classifying Cryptographic Systems

Slide 11: Classifying Cryptographic Systems
Slide 12 / 68

Cipher Classification

Slide 12: Cipher Classification
Slide 13 / 68

Cryptosystem Types

Slide 13: Cryptosystem Types
Slide 14 / 68

Figure 5.1

Slide 14: Figure 5.1
Slide 15 / 68

If P is the plaintext, C is the ciphertext, and K is the key,

Slide 15: If P is the plaintext, C is the ciphertext, and K is the key,

Notes

  1. Proof that decryption recovers P.

Slide 16 / 68

Figure 3.2

Slide 16: Figure 3.2
Slide 17 / 68

Symmetric Cryptosystem Characteristics

Slide 17: Symmetric Cryptosystem Characteristics

Notes

  1. Symmetric needs: efficient E and D, and the ciphertext must be hard to invert without the key. Problem: secure key distribution.

Exam angle

Past exam · Major 181

MCQ · problem with symmetric encryption = key distribution

Past exam · Major C

D · why symmetric is preferred for bulk data

Past exam · Major 181Q1

The classic problem with symmetric encryption is:

PredictionQ2

Why is symmetric encryption preferred for large amounts of data? (Major C)

Compare with the model answer

It uses one shared key and simple, fast operations (substitution, permutation, XOR), so it is far faster and lighter than asymmetric algorithms, which do heavy maths on huge numbers. Asymmetric is used only to exchange the symmetric key or to sign (hybrid encryption).

Slide 18 / 68

Substitution Ciphers: Caesar Cipher

Slide 18: Substitution Ciphers: Caesar Cipher

Notes

  1. Caesar: shift every letter by k: C = (P + k) mod 26.

  2. Tip Hand-cipher rules: CAESAR C = (P + k) mod 26 · VIGENÈRE add the repeated key letter (subtract to decrypt) · PLAYFAIR pairs: same row → right, same column → below, rectangle → own row, other letter’s column; X between doubles · HILL row vector × K mod 26, decrypt with K⁻¹ (det must be coprime with 26) · TRANSPOSITION write in rows, read columns in key order.

Exam angle

Past exam · Major A

A · find the Caesar key

Past exam · Major AQ1

Plaintext GLOBAL… becomes QVYLKV…. What is the Caesar key?

PredictionQ2

Caesar with shift 3 encrypts HELLO as:

Slide 19 / 68

Caesar Cipher

Slide 19: Caesar Cipher
Slide 20 / 68

Caesar Cipher

Slide 20: Caesar Cipher
Slide 21 / 68

Substitution Ciphers: ROT13

Slide 21: Substitution Ciphers: ROT13

Notes

  1. ROT13; a general substitution cipher has 26! keys.

Slide 22 / 68

Substitution Ciphers : Keyword Ciphers

Slide 22: Substitution Ciphers : Keyword Ciphers
Slide 23 / 68

Examples

Slide 23: Examples
Slide 24 / 68

Examples

Slide 24: Examples
Slide 25 / 68

Playfair Cipher

Slide 25: Playfair Cipher

Notes

  1. Monoalphabetic ciphers fall to frequency analysis → encrypt pairs of letters (Playfair).

Slide 26 / 68

Playfair Key Matrix

Slide 26: Playfair Key Matrix

Notes

  1. Playfair 5×5 matrix: keyword letters (no repeats), then the remaining letters; I/J share a cell.

Slide 27 / 68

Encrypting and Decrypting

Slide 27: Encrypting and Decrypting

Notes

  1. Rules: pairs; X between doubled letters; same row → right; same column → below; rectangle → own row, other letter’s column.

  2. Tip Hand-cipher rules: CAESAR C = (P + k) mod 26 · VIGENÈRE add the repeated key letter (subtract to decrypt) · PLAYFAIR pairs: same row → right, same column → below, rectangle → own row, other letter’s column; X between doubles · HILL row vector × K mod 26, decrypt with K⁻¹ (det must be coprime with 26) · TRANSPOSITION write in rows, read columns in key order.

Exam angle

Past exam · Major B

B · Playfair COMMITTEES with EFFECTIVENESS

Past exam · Major C

A · Playfair decryption

Past exam · Major A

Related question: B · Playfair pairs

PredictionQ1

Encrypt COMMITTEES with Playfair, keyword EFFECTIVENESS (I/J together). (Major B)

Compare with the model answer

Matrix rows: E F C T I / V N S A B / D G H K L / M O P Q R / U W X Y Z. Pairs: CO MX MI TX TE ES → FP PU RE CY IF CV.

PredictionQ2

In Playfair, two letters in the same row are replaced by:

Slide 28 / 68

Playfair Encryption and Decryption

Slide 28: Playfair Encryption and Decryption

Notes

  1. HELLO → HE LX LO.

Slide 29 / 68

Security of Playfair Cipher

Slide 29: Security of Playfair Cipher

Exam angle

PredictionQ1

In Playfair, what does cryptanalysis depend on? (Major C)

Compare with the model answer

Recovering the 5×5 key square built from the keyword, usually through digram frequency analysis.

Slide 30 / 68

Vigenère Cipher (Encryption)

Slide 30: Vigenère Cipher (Encryption)

Exam angle

Past exam · Major B

C · decrypt with key RIYADH

PredictionQ1

An advanced Caesar cipher that shifts each letter by a keyword letter is:

PredictionQ2

Decrypt CMRUVLERMYOLRX with Vigenère key RIYADH. (Major B)

Compare with the model answer

Subtract the repeated key RIYADHRIYADHRI letter by letter: LETUSENJOYLEAP (“let us enjoy LEAP”).

Slide 31 / 68

Vigenère Cipher (Decryption)

Slide 31: Vigenère Cipher (Decryption)
Slide 32 / 68

How to attack substitution: Frequency Analysis

Slide 32: How to attack substitution: Frequency Analysis
Slide 33 / 68

Substitution Ciphers: One-Time Pads

Slide 33: Substitution Ciphers: One-Time Pads

Notes

  1. One-time pad (Vernam/Mauborgne 1917): a truly random key as long as the message, used once → unbreakable.

Exam angle

PredictionQ1

Which cipher is theoretically unbreakable?

Slide 34 / 68

Example

Slide 34: Example

Notes

  1. One-time pad example.

Slide 35 / 68

Substitution Ciphers: Hill Cipher

Slide 35: Substitution Ciphers: Hill Cipher

Notes

  1. Hill (1929): m letters at a time as a vector, multiplied by an m × m key matrix mod 26.

Exam angle

Past exam · Major A

C · Hill encrypt HELP

Past exam · Major C

B · Hill key suitability and decryption

PredictionQ1

Encrypt HE with a Hill key K = [[3, 3], [2, 5]] using the row approach. (Major A)

Compare with the model answer

HE = (7, 4). (7, 4) × K = (7·3 + 4·2, 7·3 + 4·5) = (29, 41) mod 26 = (3, 15) → DP.

PredictionQ2

Any 2 × 2 matrix can be used as a Hill cipher key.

Slide 36 / 68

Slide 36

Slide 36: Slide 36

Notes

  1. Hill example.

Slide 37 / 68

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Slide 37: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Notes

  1. Letter numbering A = 0 … Z = 25.

Slide 38 / 68

◼

Slide 38: ◼
Slide 39 / 68

How to find the inverse key matrix

Slide 39: How to find the inverse key matrix
Slide 40 / 68

Transposition Cipher

Slide 40: Transposition Cipher
Slide 41 / 68

Transposition Cipher

Slide 41: Transposition Cipher

Notes

  1. Transposition keeps the letters but changes their positions: write in rows, permute/read columns by the key.

Exam angle

Past exam · Major A

B · columnar transposition

PredictionQ1

A cipher that keeps the letters but rearranges their positions is a:

Slide 42 / 68

Example

Slide 42: Example

Notes

  1. Transposition example.

Slide 43 / 68

Example

Slide 43: Example

Notes

  1. Example.

Slide 44 / 68

Example

Slide 44: Example

Notes

  1. Example.

Slide 45 / 68

Example

Slide 45: Example

Notes

  1. Example.

Slide 46 / 68

MODERN BLOCK CIPHERS

Slide 46: MODERN BLOCK CIPHERS
Slide 47 / 68

A modern block cipher

Slide 47: A modern block cipher
Slide 48 / 68

Block Ciphers

Slide 48: Block Ciphers
Slide 49 / 68

Block Ciphers

Slide 49: Block Ciphers
Slide 50 / 68

Padding

Slide 50: Padding
Slide 51 / 68

Padding

Slide 51: Padding

Exam angle

Past exam · Major A

D · blocks and padding for “Incomprehensibilities”

Past exam · Major B

blocks and padding, b = 64

PredictionQ1

b = 128 bits. Plaintext “Incomprehensibilities”. How many blocks and how many padded bits? (Major A)

Compare with the model answer

21 characters = 21 bytes. A block holds 16 bytes → 2 blocks (32 bytes). Padding = 32 − 21 = 11 bytes = 88 bits.

Past exam · Major BQ2

b = 64 bits, plaintext of 29 bytes. How many blocks?

Slide 52 / 68

Block Ciphers in Practice

Slide 52: Block Ciphers in Practice

Notes

  1. DES: IBM, adopted 1977, 56-bit key, 64-bit blocks; now broken by brute force.

Slide 53 / 68

Block Ciphers in Practice

Slide 53: Block Ciphers in Practice

Notes

  1. 3DES: three DES passes with three keys: C = E_K3(D_K2(E_K1(P))).

Slide 54 / 68

Triple DES

Slide 54: Triple DES

Notes

  1. 3DES decryption reverses it: P = D_K1(E_K2(D_K3(C))).

Exam angle

Past exam · Major A

A · 3DES with K1≠K2≠K3

Past exam · Major AQ1

3DES decryption order is:

Slide 55 / 68

Block Ciphers in Practice

Slide 55: Block Ciphers in Practice

Exam angle

PredictionQ1

AES uses a block size of:

Slide 56 / 68

Block Cipher Modes

Slide 56: Block Cipher Modes

Notes

  1. A mode describes how a block cipher handles a sequence of blocks. ECB: each block alone (identical blocks → identical ciphertext).

  2. Tip Modes: ECB C=E(P) · CBC C[i]=E(P[i] ⊕ C[i−1]), C[−1]=IV · CFB C[i]=E(C[i−1]) ⊕ P[i] · OFB keystream V[i]=E(V[i−1]) · CTR keystream E(counter).

Slide 57 / 68

Cipher Block Chaining (CBC) Mode

Slide 57: Cipher Block Chaining (CBC) Mode

Exam angle

Past exam · Major A

D · identify the mode and write P[2]

Past exam · Major B

D · identify the mode and write C[2]

PredictionQ1

In CBC, write the decryption function for P[2]. (Major A)

Compare with the model answer

P[2] = D_K(C[2]) ⊕ C[1] (with C[−1] = IV for the first block).

PredictionQ2

Which mode XORs each plaintext block with the previous ciphertext block before encryption?

Slide 58 / 68

Cipher Feedback (CFB) Mode

Slide 58: Cipher Feedback (CFB) Mode

Exam angle

Past exam · Major A

A · pick the CFB figure

Past exam · Major AQ1

C[i] = E_K(C[i−1]) ⊕ P[i] describes:

Slide 59 / 68

Output Feedback (OFB) Mode

Slide 59: Output Feedback (OFB) Mode

Notes

  1. OFB: keystream from repeatedly encrypting the IV; C[i] = V[i] ⊕ P[i].

Slide 60 / 68

Counter (CTR) Mode

Slide 60: Counter (CTR) Mode
Slide 61 / 68

ATTACKING CONVENTIONAL ENCRYPTION SCHEMES

Slide 61: ATTACKING CONVENTIONAL ENCRYPTION SCHEMES
Slide 62 / 68

1. Cryptanalysis

Slide 62: 1. Cryptanalysis
Slide 63 / 68

Ciphertext only Attack

Slide 63: Ciphertext only Attack
Slide 64 / 68

Known Plaintext Attack

Slide 64: Known Plaintext Attack
Slide 65 / 68

Chosen Plaintext Attack

Slide 65: Chosen Plaintext Attack

Exam angle

PredictionQ1

An attacker who can get any plaintext of their choice encrypted is performing a:

Slide 66 / 68

Chosen Ciphertext Attack

Slide 66: Chosen Ciphertext Attack
Slide 67 / 68

2. Brute Force Search

Slide 67: 2. Brute Force Search

Notes

  1. Brute force: try every key; effort grows with key size.

Slide 68 / 68

Slide 68

Slide 68: Slide 68

Notes

  1. End of chapter.

  2. Seen again Ch 6.1, slide 3: Asymmetric cryptography