1.3.1 Compression, Encryption and
Hashing
(a) Lossy vs Lossless compression.
Compression
• a process used to reduce the storage space required by a file
Lossy compression
• removes non-essential information/data from a file
• results in permanent data loss
Lossless compression
• all data from the original file can be retrieved
• records patterns in data rather than the actual data
• files compressed with lossless compression are usually larger than files
compressed with lossy compression
(b) Run length encoding and dictionary coding for lossless
compression.
Run length encoding
• lossless compression method
• repeated values are replaced with one occurrence of the data followed by the
number of times it is repeated
• relies on many consecutive data values being the same
• RLE will not greatly reduce the size of a file if it contains little repetition
Dictionary coding
• lossless compression method
• frequently occurring pieces of data are replaced with an index
• each index has an entry in the dictionary that matches it to its corresponding
data
Hashing
(a) Lossy vs Lossless compression.
Compression
• a process used to reduce the storage space required by a file
Lossy compression
• removes non-essential information/data from a file
• results in permanent data loss
Lossless compression
• all data from the original file can be retrieved
• records patterns in data rather than the actual data
• files compressed with lossless compression are usually larger than files
compressed with lossy compression
(b) Run length encoding and dictionary coding for lossless
compression.
Run length encoding
• lossless compression method
• repeated values are replaced with one occurrence of the data followed by the
number of times it is repeated
• relies on many consecutive data values being the same
• RLE will not greatly reduce the size of a file if it contains little repetition
Dictionary coding
• lossless compression method
• frequently occurring pieces of data are replaced with an index
• each index has an entry in the dictionary that matches it to its corresponding
data