Data Compression and Encryption
Aligned to the AQA 7517 specification
- Level
- Intermediate
- Reading time
- 6 min
- Published
- 13 June 2026
- Updated
- 1 July 2026
On this page
Key takeaways
- Lossless compression (such as RLE and dictionary-based LZW) lets the original data be reconstructed perfectly, while lossy compression permanently discards some data to achieve much higher compression ratios.
- Run-length encoding replaces consecutive repeated values with a (value, count) pair and is most effective on long runs of the same value, performing poorly on complex images with many colour changes.
- Encryption transforms plaintext into ciphertext using a cipher and a key; the Caesar cipher shifts each letter by a fixed amount and has only 25 keys, making it breakable by exhaustive key search and frequency analysis.
- The Vernam cipher (one-time pad) XORs each plaintext bit with a key bit and is provably perfectly secure only if the key is truly random, at least as long as the message, used exactly once, and kept completely secret.
- AES and RSA are only computationally secure, relying on computational hardness rather than mathematical proof, so unlike the correctly used Vernam cipher they are not proven unbreakable.
Want more lessons like this one?
Generate lessons on anything you study. Free account, no card needed.
Key terms
- Lossless compression
- Compression where the original data can be reconstructed perfectly, giving moderate (2–5×) compression ratios.
- Lossy compression
- Compression that permanently discards some data to achieve much higher (10–100×) compression ratios; the original cannot be recovered.
- Run-length encoding (RLE)
- A lossless method that replaces consecutive repeated values with a (value, count) pair, most effective on long runs of the same value.
- Dictionary-based compression
- A lossless method (e.g. LZW, used in PNG and GIF) that builds a dictionary of repeated patterns and replaces longer repeated substrings with short codes.
- Plaintext
- The original readable message before encryption.
- Ciphertext
- The encrypted, unreadable output of a cipher.
- Cipher
- The algorithm used to encrypt and decrypt data.
- Key
- A value that controls the cipher's operation; the same plaintext with different keys produces different ciphertext.
- Caesar cipher
- A substitution cipher that shifts each letter of the plaintext by a fixed number of positions in the alphabet, with the key being the shift amount (1–25).
- Frequency analysis
- An attack that exploits known letter frequencies in a language, such as 'E' being most common in English, to deduce a cipher's key.
- Vernam cipher (one-time pad)
- A cipher that XORs each plaintext bit with a key bit and is provably perfectly secure if the key is truly random, at least as long as the message, used once, and kept secret.
- Computational security
- Security that relies on breaking a cipher requiring more computation than is currently feasible, rather than being mathematically proven unbreakable, as with AES and RSA.
Frequently asked questions
Lossless compression lets the original data be recovered perfectly and gives moderate ratios (2–5×), suiting text, executables, source code, and medical images. Lossy compression permanently discards some data to reach much higher ratios (10–100×) and suits photos (JPEG), audio (MP3), and video (H.264). A lossy file cannot be restored to the original.
Because it has only 25 possible keys, an attacker can try all 25 shifts in seconds by exhaustive key search. It is also vulnerable to frequency analysis: in English, 'E' is most common, so if 'X' is most common in the ciphertext the key is likely 23. Security depends on key space size, not alphabet size.
Because it XORs the plaintext with a truly random key at least as long as the message, used once and kept secret, every possible plaintext that produces the given ciphertext is equally likely, so no amount of computation can determine the plaintext without the key. XOR with a short or repeated key is not a Vernam cipher and is easily broken.
Generate revision on any topic you study
Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set, personalised to your level.
Lessons on anything
Structured, level-matched lessons on any topic you study
Practice quizzes
Find out what you actually know before the exam does
Flashcard sets
Lock in key concepts with instant revision cards
Ask Aica
Stuck on something? Get a clear explanation, any time
Images, Sound and Data Representation
Software, Operating Systems and System Software
Related lessons
7 min
5 min
6 min