Year 9 · Autumn 2

Cybersecurity · Lesson 4 of 5

Defences, and a Caesar cipher in Python

PracticalTopic 17 Cybersecurity

Year 9 · Cybersecurity · Lesson 4 of 5

You will learn to

  • Encrypt and decrypt a word with a Caesar cipher by hand.
  • Use ord, chr and mod 26 in Python, so a shift past Z wraps round to A.
  • Explain why a Caesar cipher is weak: there are only 25 useful keys.
  • Name four layers of defence, like 2FA, updates, a firewall and backups, and what each stops.

Year 9 · Cybersecurity · Lesson 4 of 5

Success criteria

You have got it when you can say:

  • I can turn HELLO into KHOOR with a shift of 3, and back again.
  • I can predict that ord('A') is 65 and chr(66) is 'B'.
  • I can crack a Caesar message by trying every shift.
  • I can name four layers of defence and the attack each one stops.

Year 9 · Cybersecurity · Lesson 4 of 5

Retrieval starter

Questions from before. Write your answers, then show them.

  1. Last lesson

    Program runs but gives the wrong answer. That's a…

    A Syntax errorB Logic error

    B. Logic error

  2. Last unit

    A variable made inside a function is…

    A Saved to a fileB Local: only exists inside it while it runsC Global: usable anywhere

    B. Local: only exists inside it while it runs

  3. Earlier this unit

    Logging into a friend's account 'just to look' is…

    A An offence under the Computer Misuse ActB Legal if you change nothingC Only illegal in Spain

    A. An offence under the Computer Misuse Act

Year 9 · Cybersecurity · Lesson 4 of 5

Key words (1 of 2)

two-factor authentication
Logging in with two things: e.g. a password and a phone code.
Firewall
Checks network traffic and blocks what isn't allowed.
Encryption
Scrambling data so only someone with the key can read it.
Malware
Malicious software: viruses, worms, trojans, ransomware, spyware.

Year 9 · Cybersecurity · Lesson 4 of 5

Key words (2 of 2)

Phishing
Fake messages that trick people into giving details.
Brute force
Trying every possible password until one works.

The explanation · step 1 of 2 · part 1 of 2

Defences

  • Strong passwords + two-factor authentication: a code on your phone too.
  • Lock-outs after 3–5 wrong tries.
  • Firewall: blocks traffic that breaks its rules.
  • Anti-malware.
  • Updates (patches): fix security holes.
  • Encryption.
  • Backups: beat ransomware.

The explanation · step 1 of 2 · part 2 of 2

Defences (continued)

  • Access levels: students can't edit grades.
  • Input validation: stops SQL injection.
  • Penetration testing: paid, permitted ethical hackers.
  • Physical security: locks, cameras, swipe cards.

The explanation · step 2 of 2 · part 1 of 2

Encryption

Encryption turns plaintext into ciphertext with a key. Only someone with the key can turn it back.

  1. Caesar cipher, key = 3: shift each letter 3 places.
  2. H → K, E → H, L → O, L → O, O → R.
  3. HELLO → KHOOR. Shift back 3 to decrypt.
!Watch out

Caesar is easy to break: only 25 possible shifts. Modern keys are hundreds of bits long (2²⁵⁶ possibilities).

The explanation · step 2 of 2 · part 2 of 2

Encryption (continued)

Symmetric: same key locks and unlocks. Public-key: anyone locks with your public key; only your private key unlocks. HTTPS uses both.

The explanation · step 2 of 2

The maths: Caesar cipher as maths

Year 9 · Cybersecurity · Lesson 4 of 5

Try it: Caesar cipher

Year 9 · Cybersecurity · Lesson 4 of 5

Quick quiz · 1 of 3

Websites should store your password as…

  1. A Plain text
  2. B A Caesar cipher
  3. C A hash

C. A hash

A one-way fingerprint: a leak doesn't reveal the passwords.

Year 9 · Cybersecurity · Lesson 4 of 5

Quick quiz · 2 of 3

A fake bank email asking you to log in is…

  1. A A worm
  2. B Phishing
  3. C Brute force

B. Phishing

It fishes for your details with a fake message.

Year 9 · Cybersecurity · Lesson 4 of 5

Quick quiz · 3 of 3

Which spreads across a network without anyone opening a file?

  1. A Trojan
  2. B Worm
  3. C Virus

B. Worm

A worm copies itself by itself. A virus needs a person to share the file.

Year 9 · Cybersecurity · Lesson 4 of 5

Exit ticket

Answer on paper before you go. Then check.

  1. Ransomware mainly breaks which part of the CIA triad?

    A ConfidentialityB AvailabilityC Integrity

    B. Availability Your files are still there but you can't use them: availability.

  2. Which makes a password hardest to crack?

    A Adding ! at the endB Adding lengthC Swapping o for 0

    B. Adding length Each extra character multiplies the possibilities; swaps are tried first by attackers.