1.3.1 - Compression, Encryption and Hashing Flashcards

1
Q

What is compression?

A

Compression is the process used to reduce the storage space required by a file, meaning
you can store more files with the same amount of storage space.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is compression useful in apps?

A

Apps like Google Photos compress files so that they can quickly be searched for and
downloaded. Downloading a compressed file over the Internet is faster than downloading
the full version of the file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does lossy compression do?

A

Lossy compression reduces the size of a file while also removing some of its information. This
could result in a more pixelated image or less clear audio recording.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does lossless compression do?

A

Lossless compression reduces the size of a file without losing any information. The original file can be recovered from the compressed version.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is run length encoding?

A

Run length encoding is a method of lossless compression in which repeated values are removed and replaced with one occurrence of the data followed by the number of times it should be repeated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When does run length encoding work?

A

Run length encoding relies on consecutive pieces of data being the same - if there’s little repetition, run length encoding doesn’t offer a great reduction in file
size.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is dictionary encoding?

A

Dictionary encoding is another example of a method of lossless compression. Frequently occurring pieces of data are replaced with an index and compressed data is stored alongside a dictionary which matches the frequently occurring data to an index. The
original data can then be restored using the dictionary.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is encryption?

A

Encryption is used to keep data secure when it’s being transmitted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does symmetric encryption work?

A

In symmetric encryption, both the sender and receiver share the same private key, which they distribute to each other in a process called a key exchange.
This key is used for both
encrypting and decrypting data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why should the private key be kept secret?

A

If the key is intercepted during the key

exchange then any communications sent can be intercepted and decrypted using the key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How does asymmetric encryption work?

A

Two keys are used: one public
and a second, private, key. The public key can be published anywhere, free for the world
to see, while the private key must be kept secret. Together, these keys are known as a key
pair and are mathematically related to one another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How are messages encrypted and decrypted?

A

A single key cannot be used to encrypt and decrypt communication. Instead, messages encrypted with the recipient’s public key can only be decrypted with the recipient’s private key. So, someone can find your public key on a website and send you a message only you can decode.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How can you prove a message was sent by you?

A

You can encrypt it using your private key, meaning anyone can decrypt it with your public key. This guarantees you encrypted the message, and forms the basis of a system called digital signatures.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is hashing?

A

Hashing is the name given to a process in which an input (called a key) is turned into a
fixed size value (called a hash). There are a vast number of functions, called hash functions, which do this.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the difference between encryption and hashing?

A

The output of a hash function can’t be reversed to form the key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Why is hashing useful for storing passwords?

A

A password entered by a user can be
hashed and checked against the key to see if it is correct, but a successful hacker would only gain access to the keys, which can’t be reversed to gain the passwords.

17
Q

What is a hash table?

A

A hash table is a data
structure which holds key-value pairs.
Formed from a bucket array and a hash function, hash tables can be used to lookup data in an array in constant time. When data needs to be
inserted, it is used as the key for the hash function and
stored in the bucket corresponding to the hash.

18
Q

Where are hash tables used?

A

Hash tables are used extensively in situations where a lot of data needs to be stored with
constant access times. For example, in caches and databases.

19
Q

What happens if two keys produce the same hash?

A

A collision is said to have occurred. There are a variety of methods to overcome collisions, including storing items together in a list under the hash value or using a second hash function to generate a new hash.

20
Q

What is a good hash function?

A

A good hash function should have a low chance of collision and should be quick to calculate.
Furthermore, a hash function should provide an output which is smaller than the input it was provided, otherwise searching for the hash could take longer than simply searching for the key.