Compression, Encryption and Hashing — OCR A-Level Computer Science
Test yourself on Compression, Encryption and Hashing with OCR A-Level practice questions.
7 days Premium · Then free forever · No card, no charge
Compression, Encryption and Hashing explained
This topic covers the fundamental techniques used for data management and security in computer systems.
Read the full explanation
It explores the principles of data compression, the mechanisms of symmetric and asymmetric encryption, and the role of hashing in data integrity.
What to demonstrate
- Distinction between lossy and lossless compression
- Application of run length encoding
- Application of dictionary coding
Show all 5 objectives
- Understanding of symmetric encryption
- Understanding of asymmetric encryption
Compression, Encryption and Hashing exam tips
Topic Overview
Compression, encryption, and hashing are fundamental techniques in computer science for managing data efficiently and securely. Compression reduces file sizes for storage and transmission, encryption ensures data confidentiality by converting plaintext into ciphertext, and hashing provides data integrity by generating fixed-size digests. These concepts are essential for understanding how modern systems handle data securely and efficiently, from streaming services to secure communications.
In the OCR A-Level specification, you need to understand both lossy and lossless compression algorithms, symmetric and asymmetric encryption, and the properties of hash functions. These topics link to broader areas like network security, data storage, and error detection. Mastery of these concepts is crucial for exam questions that ask you to compare algorithms, explain their applications, or analyse their strengths and weaknesses.
Real-world applications include JPEG compression for images, AES encryption for secure data transmission, and SHA-256 for verifying file integrity. Understanding these techniques prepares you for further study in cybersecurity, data science, and software engineering, and is directly assessed in Paper 1 and Paper 2 of the OCR A-Level.
Key Concepts
- →Lossless vs lossy compression: Lossless (e.g., Run-Length Encoding, Huffman coding) preserves all original data, while lossy (e.g., JPEG, MP3) discards some data to achieve higher compression ratios.
- →Symmetric encryption uses the same key for encryption and decryption (e.g., AES), while asymmetric encryption uses a public/private key pair (e.g., RSA).
- →Hash functions (e.g., SHA-256) produce a fixed-size output from any input, are one-way (cannot be reversed), and are collision-resistant (two different inputs should not produce the same hash).
- →Encryption ensures confidentiality; hashing ensures integrity and authenticity (e.g., password storage, digital signatures).
- →Compression ratio = original size / compressed size; higher ratio means more compression.
Marking Points
- Distinction between lossy and lossless compression
- Application of run length encoding
- Application of dictionary coding
- Understanding of symmetric encryption
- Understanding of asymmetric encryption
Examiner Tips
- 💡Ensure you can clearly define the difference between lossy and lossless compression
- 💡Be prepared to perform run length encoding on a given string of data
- 💡Understand the key difference between symmetric and asymmetric encryption regarding the use of keys
- 💡When comparing compression algorithms, always mention the trade-off between file size and quality (lossy) or computational overhead (lossless). Use specific examples like ZIP vs JPEG.
- 💡For encryption questions, clearly distinguish between symmetric and asymmetric, and state which is faster (symmetric) and which solves key distribution (asymmetric).
- 💡In hashing questions, emphasise properties: deterministic, fast to compute, preimage resistant, collision resistant. Use real-world examples like password hashing (with salt) or file integrity checks.
Common Mistakes
- Confusing the mechanisms of symmetric and asymmetric encryption
- Failing to explain the difference between lossy and lossless compression in terms of data recovery
- Misapplying run length encoding to data that does not contain repeated sequences
- Misconception: Encryption and hashing are the same. Correction: Encryption is reversible (with the key), while hashing is one-way and cannot be decrypted.
- Misconception: Lossy compression always results in noticeable quality loss. Correction: Modern lossy algorithms (e.g., JPEG at high quality) can be nearly indistinguishable from the original while significantly reducing file size.
- Misconception: A hash can be used to encrypt data. Correction: Hashes are not encryption; they are used for verification, not confidentiality.