1.3.1 Compression, Encryption and Hashing Flashcards
(a) Lossy vs Lossless compression. (b) Run length encoding and dictionary coding for lossless compression. (c) Symmetric and asymmetric encryption. (d) Different uses of hashing.
What is the current need of compression?
Internet service providers and mobile networks set limits and charges on bandwidth so the reduction of file sizes is important to ensure that people can view more with the limited amount of bandwidth.
What is Lossy compression?
Lossy compression is an algorithm where in order to reduce the size of a file, non essential data is removed.
What is an advantage of file compression?
Files will download quicker and use less of the users bandwidth.
What is Lossless compression?
Lossless compression works by recording the patterns in data rather than recording the data itself, using the patterns and the instructions on how to use them, a computer can reproduce the exact data.
Whats the difference between Lossy and Lossless compression?
Lossy compression takes away some of the data from the original. Lossless preserves all the information.
Why might Lossy compression be inappropriate in the compression of a text file?
Data lost from a text file may render it unreadable.
What are two examples of Lossless compression techniques?
RLE (Run Length Encoding) and Dictionary-Based Compression.
What is RLE and how does it work?
Run length encoding is a type of lossless compression where rather than recording every item in a sequence, it simply records the value and the number of time it repeats.
Why would RLE be inappropriate for this string, QWERTYUIOPASDFGHJKLZXCVBNM?
Run Length encoding relies on consecutive pieces of data being the same in order to work best. Therefore RLE would not work great with that string as there are no repeats of data.
What is RLE best for? and what is it not suited to?
RLE works best for simple images where there a lots of repeated colors, It does not work as great for natural language due to lack of repeating data.
What is Dictionary-Based compression and how does it work? (Including decompression)
In dictionary encoding frequently occurring groups of characters are replaced by symbols/tokens which represent the longer groups of characters. A dictionary is then used to say which symbols/tokens/ match which groups of characters. When decompressed the dictionary is used to replace the tokens/symbols with the original text.
What technique would be most suitable to compress the following and why?, “What’s in a name? that which we call a rose By any other name would smell as sweet; So Romeo would, were he not Romeo call’d,”
Dictionary-Based compression because there a lots of repeated groups of characters, for example “name”, “Romeo”, “SPACE”.
Demonstrate how you could compress the following using Dictionary-Based compression. ““Nory was a Catholic because her mother was a Catholic, and Nory’s mother was a Catholic because her father was a Catholic, and her father was a Catholic because his mother was a Catholic, or had been.””
Firstly I counted the frequency of the character groups and SPACE had a frequency of 36, “a” was repeated 6 times and “was” was also repeated 6 times. So to ill assign SPACE to 1, “a” to 2 and “was” to 3. Nory1321Catholic1because1her1mother1321Catholic etc etc.”
Why is Lossy compression more suited to photographs than Lossless compression?
When compressing a photograph some loss of detail is acceptable as the image will still be recognisable and the loss of detail is likely not going to be noticeable. Lossy compression also makes the file smaller than Lossless.
What is the Vernam cipher?
The Vernam Cipher was invented in 1917 by Gilbert Vernam and is proven to be unbreakable.