Chapter 19 — Cryptography basics
Lesson map
Lesson 19 published. Map, example, EX055.
flowchart TD
N0["Learning outcomes"]
N1["19.1 Encryption"]
N2["19.2 Hashing"]
N3["19.3 Digital signatures"]
N4["19.4 Common mistakes"]
N0 --> N1 --> N2 --> N3 --> N4
N4 --> EX["Worked example"]
EX --> Q["Exercise EX055"]
Logical drawing
flowchart LR
N0["Learning outcomes"]
N1["19.1 Encryption"]
N2["19.2 Hashing"]
N3["19.3 Digital signatures"]
N4["19.4 Common mistakes"]
N0 --> N1 --> N2 --> N3 --> N4 --> Q["EX055"]
[Learning outcomes]
|
v
[19.1 Encryption]
|
v
[19.2 Hashing]
|
v
[19.3 Digital signatures]
|
v
[19.4 Common mistakes]
|
v
[Worked example] --> [Exercise EX055]
Learning outcomes
You will (1) explain symmetric and public-key encryption; (2) describe hashing and digital signatures; (3) recognise common cryptographic mistakes.
19.1 Encryption
Encryption transforms readable data into unreadable form using a key. Aisha learns that symmetric encryption uses one shared key for both encryption and decryption, and is fast, so it protects stored data and network traffic. Public-key encryption uses a pair: a public key anyone can use to encrypt and a private key only the owner holds to decrypt. Dr. Carrow explains that websites use both together: public keys to agree on a shared key, then symmetric encryption for speed. She tries both in the laboratory.
19.2 Hashing
A hash function produces a fixed-length fingerprint of data. Changing one bit of the input changes the fingerprint completely, and it is impractical to find another input with the same fingerprint. Aisha uses Python's hashlib module to compute SHA-256 fingerprints of synthetic files and confirms that a small change produces a different result. She learns that hashes verify integrity, such as checking that a downloaded file is genuine. She records the two fingerprints in her journal to show the difference, and explains the idea to her seminar group with a printed example.
19.3 Digital signatures
A digital signature uses a private key to sign data and the matching public key to verify it. Anyone can check the signature, but only the key holder could have produced it. Aisha learns that software updates are signed so computers can reject tampered versions. At Ashfield, signed emails could help members recognise genuine messages. Dr. Carrow notes that signatures provide authenticity and integrity, but depend on keeping private keys secure. She checks that Ashfield's computers verify signed updates before installing them.
19.4 Common mistakes
Aisha studies common mistakes: inventing new algorithms, using outdated ones, storing keys beside encrypted data and failing to renew certificates. She finds that Ashfield's backup files are encrypted, but the key is stored in the same folder. She recommends separate key storage. She learns that most cryptographic failures come from how keys are handled and systems configured, not from breaking the mathematics. The IT manager moves the key to a separate protected store the same week. Aisha then confirms that a test restore still works with the key retrieved from its new location.
Worked example
Aisha compares symmetric and public-key encryption, computes SHA-256 fingerprints, explains signed updates and finds backup keys stored beside backups.
Synthetic case. Examples are synthetic.
Errors and limits
Storing keys beside encrypted data defeats the encryption.
Exercises
- EX055 — Symmetric use. Why is symmetric encryption used for bulk data? Rubric: 3 = it is fast;; 2 = partly correct;; 1 = vague;; 0 = none.
- EX056 — Hash property. What happens when one input bit changes? Rubric: 3 = the fingerprint changes completely;; 2 = partly correct;; 1 = vague;; 0 = none.
- EX057 — Backup key. Where was the backup key stored? Rubric: 3 = in the same folder as backups;; 2 = partly correct;; 1 = vague;; 0 = none.
Continue studying — lesson 19 (chapter 19 of 40)
← Chapter 18 · Course chapter index · Chapter 20 →
Continue to the next authored lesson.