Exam Board:
OCR A-Level
3.1 - Compression, Encryption and Hashing
Specification:
Computer Science H446
Watch on YouTube:
Lossy & Lossless Compression
Lossless Compression Algorithms
Encryption
Hashing
Lossy vs Lossless Compression

Compression is the process of reducing the size of a file so it takes up less storage space and can be transmitted more quickly over a network. It works by encoding data more efficiently or removing unnecessary information. The main benefits of compression include faster file transfer speeds, reduced storage requirements and improved performance when streaming data.
​
-
Lossy compression permanently removes some data that is less important to human perception, such as subtle sounds or image details, resulting in smaller file sizes but slightly lower quality.
​​​
-
Lossless compression reduces file size without losing any data, allowing the original file to be perfectly restored after it is decompressed.
Lossless Compression Algorithms

There are two types of lossless compression that you need to know:
​
-
Run-Length Encoding (RLE) is a simple form of lossless compression that reduces file size by storing repeating data as a single value and a count. For example, a sequence like AAAAABBBCCCC could be stored as A5B3C4, saving space in files with many repeated elements, such as pixels in images.
​
-
Dictionary Encoding replaces repeating patterns of data with shorter codes that reference entries in a dictionary. The dictionary stores common sequences once, and each repetition is replaced by a shorter reference, making it efficient for text and other data with recurring patterns.
Encryption
Encryption is the process of converting readable data (plaintext) into an unreadable form (ciphertext) to prevent unauthorised access. It ensures the confidentiality and security of information during storage or transmission. There are two key types of encryption:
​
-
Symmetric encryption uses the same key for both encryption and decryption, meaning the sender and receiver must share the key securely. It is fast and efficient, making it suitable for encrypting large amounts of data. However, key distribution is a major risk if the key is intercepted.
​
-
Asymmetric encryption uses a pair of keys - a public key for encryption and a private key for decryption. It is more secure for communication but slower due to complex mathematical processes. Asymmetric encryption is often used to exchange symmetric keys securely before data transfer.

Hashing
Hashing is the process of applying a mathematical function (hash function) to data to produce a fixed-size value, known as a hash. It is a one-way process, meaning the original data cannot be reconstructed from the hash.
​
Hashing is commonly used for data integrity checks, password storage and digital signatures. Even a tiny change in the input data produces a completely different hash, making it useful for detecting tampering or corruption.

Questo's Key Terms
Compression: lossy compression, lossless compression, run-length encoding, dictionary encoding
​​​​
Encryption: plaintext, ciphertext, key, symmetric encryption, asymmetric encryption
​​
Hashing: hash function, hash​
Did You Know?
Alan Turing and his team used pattern recognition to analyse recurring sequences in encrypted German messages, helping to break the Enigma code, which was a major factor in the Allies’ victory in World War II.

