Compression, Encryption, Hashing Flashcards

1
Q

Run length encoding

A

Finds runs of repeated binary patterns and replaces them with a single instance of the pattern and the number of how many times it is repeated.
Well suited to image data as these often have repeated blocks of colour.
Lossless.

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

Dictionary coding

A

Algorithm allocates a code for each different word and store the code instead of the word. Table stores which word each code represents.
Lossless
Needs enough bits for all the unique words.

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

Lossy compression

A

Compression techniques that always result in a loss of data.
The recreated data will never be an exact copy of the original - it will be an approximation.
Used in audio files, JPEG (photos), MPEG-1 and MPEG-2 (video files)

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

Lossless compression

A

Compression techniques where no data is lost.
When decompressed, the contents are identical to the original.
Used when data cannot be approximated eg text files.
Common formats: PNG (high quality pictures), GIF and ZIP files.

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

Encryption

A

The process of converting a plain text message into cipher text using a cipher and a key.

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

Cipher

A

A set of instructions (algorithm) for encrypting plain text. The same algorithm can be used with many different key values.

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

Key

A

Additional information used by the cipher algorithm. Also needed for the decryption process.

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

Symmetric encryption

A

The same key is used to encrypt and decrypt so the key must be shared between the sender and receiver.
The Diffie-Hellman key exchange allows both parties to generate a shared key using a set of public and private keys. This means there is no exchange of keys, so the encryption is more secure.
Generates the key over the Transport Layer Security at the start of a session.

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

Asymmetric encryption

A

Different keys (mathematically linked) are used to encrypt and decrypt. This means keys do not need to be shared.
The RSA algorithm (Rivest, Shamir, Adleman) generates several components which are mathematically linked so that a message encrypted using one set can be decrypted using the other set.
These components are known collectively as a public and private key pair.
Public key is widely shared but private key is only known to its owner.

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

Sender authentication

A

Encryption: sender’s private key + receiver’s public key
Decryption: receiver’s private key + sender’s public key

If it was not the correct sender, the receiver would not be able to decrypt it.

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

Hash table

A

Must be an array - have to access each position directly by specifying the index
Positions are sometimes called buckets - each is used to store data. Can be single data or more complex eg a record
Size must be big enough to store everything but not so big is wastes space. Must have some free space.
Load factor = n/k
k = number of buckets
n = number of occupied buckets
Load factor of about 0.75 is optimal

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

Hash functions

A

Always produce the same hash value for the same hash key
Provide a uniform distribution of hash values
Minimise clustering - when many different keys produce the same hash value
Be very fast to compute

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

Inserting data into a hash table

A

The hash function generates the index of the position in the array that will be used to store the data.
The key must be stored as part of the data

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

Retrieving values from a hash table

A

The hash function is applied to the key to generate the index.
Always O(1) unless collisions have occured
If no data in that index, the data is not in the table.

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

Collisions

A

When two or more keys produce the same hash value.
Linear probing: the second data is placed in the next available position. To retrieve, mush check the index to see if it matches the key. If not, linear search until match is found.
Chaining: a linked list is created at that index. To retrieve search along the linked list until the key is found.

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

Rehashing

A

Used when the hash table starts to fill up or a large number of items are in the wrong place causing the performance to degrade.
A new hash table is created and each item is rehashed and inserted.
Hashing algorithm may need to be modified.
Opportunity to review the effectiveness of the hash function and how collisions are handled.

17
Q

Hashing databases

A

The primary key can be hashed to provide a physical location to store the data in a hash table.

18
Q

Uses of hashing

A

Storing passwords - hackers can only get the hashed version.

19
Q

Salt

A

A piece of random data that is added to a password before hashing it.
Stored in a plain text with the user’s ID and hashed password.
When a user logs in, the salt value is added to the entered password and the combined data is hashed and compared to the stored value.
Means that if someone uses the same password for multiple systems different hash values will be stored.