1.3.1 Compression, Encryption and Hashing Flashcards Preview

A-Level OCR Computer Science > 1.3.1 Compression, Encryption and Hashing > Flashcards

Flashcards in 1.3.1 Compression, Encryption and Hashing Deck (29)
Loading flashcards...
1

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.

2

What is Lossy compression?

Lossy compression is an algorithm where in order to reduce the size of a file, non essential data is removed.

3

What is an advantage of file compression?

Files will download quicker and use less of the users bandwidth.

4

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.

5

Whats the difference between Lossy and Lossless compression?

Lossy compression takes away some of the data from the original. Lossless preserves all the information.

6

Why might Lossy compression be inappropriate in the compression of a text file?

Data lost from a text file may render it unreadable.

7

What are two examples of Lossless compression techniques?

RLE (Run Length Encoding) and Dictionary-Based Compression.

8

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.

9

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.

10

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.

11

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.

12

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".

13

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."

14

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.

15

What is the Vernam cipher?

The Vernam Cipher was invented in 1917 by Gilbert Vernam and is proven to be unbreakable.

16

Define encryption.

Encryption is the transformation of data from one form to another to prevent unauthorised third party viewings.

17

What is plain text?

Plain text is the original data or message before it has been encrypted.

18

What is ciphertext?

Cipher text refers to the encrypted data.

19

Define a cipher.

A cipher is the encryption method or algorithm used to encrypt data.

20

What is an example of a substitution cipher?

A Caeser Cipher.

21

What is private key encryption?

Private key encryption is symmetric encryption where the key is used to both encrypt and decrypt the ciphertext, this means the key must be transferred in key exchange to the same destination as the cipher text.

22

Whats the issue with symmetric encryption?

Since the same key is used to both decrypt and encrypt data, a malicious third party could simply intercept the key and view the data.

23

What is public key encryption?

Asymmetric encryption uses two separate keys to encrypt and decrypt data, the public key is used to encrypt data to allow anyone to send you data encrypted, the other key is a private key that only you have, this can be used to decrypt the data and its practically impossible to deduce the private key from the public key.

24

What is a hash?

A result generated by applying an algorithm
process to a value.

25

How does a digital signature work?

The sender of the message uses their own private key to encrypt the hash total, this is the digital signature, the signature is then attached to the message being sent and the whole message is encrypted using the public key of the recipient including the digital signature. When the recipient decrypts the message using their private key and decrypts the digital signature using the senders public key. The hash total is then reproduced based on the message data and if this matches the digital signature then its certain that the message came from the sender.

26

Whats an advantage of storing sensitive data as a hash?

Hash functions are one way and cannot be reversed so if someone gained access to a data base they would not be able to access the sensitive data.

27

What is an advantage of Lossy compression?

The advantage is that with lossy compression, you can typically achieve a far better compression ratio as compared with lossless.

28

Write a pseudo code representation of how a password might work being stored as a hash.

temp == hash(UserEnteredPassword)
if temp == PasswordHash then
print ("Access granted")
else
print("Access denied")
endif

29

Write a pseudocode representation of RLE for an image.

set color to 0
set count to 0
for each pixel in the image
if current pixel color not equal to color then
write count
set color to current pixel color
set count to 1
else
increment count by 1