Exchanging data Flashcards
Why is compression important for sharing files?
Compression is the process of reducing the amount of storage required by a file.
The bigger the file = the more time it takes to get transferred
So compressing files increases the number of files that you can transfer in a given time
Downloading the full version of a file is faster than downloading the compressed file over the internet
TRUE OR FALSE
FALSE
Downloading the compressed file over the Internet is faster than downloading the full version of a file
Give categories of compression
Lossy and Lossless
Lossy compression
Reduces file size while REMOVING SOME INFORMATION
So compressed image is more pixelated/sound is less clearer
Compressed file cant be turned back into original
Lossless compression
Reduces file size WITHOUT REMOVING INFORMATION
So compressed file can be turned back to the original without loss of quality
How would you compress audio files? Which compression category would you use?
Using LOSSY
Removing very high or very low frequences which are less noticeable to the ear
However, there is no way to go back to the original as there is no record of these high or low frequences and how high and low they were
Run Length Encoding is a type of….
Lossless compression
Run Length Encoding
LOSSLESS COMPRESSION
Repeated values are rempved and replaced with one occurence of the data followed by the number of times its repeated
When would Run Length Encoding not be suitable?
When there is not much redundant data so it wouldnt offer a large reduction in file size
What is Dictionary encoding?
LOSSLESS COMPRESSION
Frequently occuring pieces of data are replaced with an index
Compressed data is stored alongside a dictionary which matches the frequently occuring data to an index
Dictionary encoding is an example of….
Lossless compression
Give a disadvantage of Dictionary encoding
The compressed data has to be stored alongside the dictionary which will increase the file size of the compressed data.
Without the dictionary the original data cant be restored.
What is meant by encryption?
The process of scrambling data do that it can only be understood by the sender and intended recipient
What is symmetric encryption?
Both the sender and receiver share the same private key
So SAME KEY IS USED FOR ENCRYPTING AND DECRYPTING DATA
This private key is distributed in a process called key exchange
In Symmetric encryption both the sender and receiver share the same private key
This private key is distributed in a process called…
Key exchange
What is Asymmetric encryption?
2 keys are used
The 2 public keys can be published anywhere but the 2 private keys are to be kept secret
Message is encrypted with senders private key and recipients public key and decrypted using receivers private key and senders public key
Explain the process of hashing (simple)
An input called a key is turned into a fixed size value called a hash using a hashing function (algorithm)
The output of a hash function can be reversed to form the key
TRUE OR FALSE
FALSE
The output of a hash function CAN’T be reversed to form the key
The output of a hash function CAN’T be reversed to form the key
What would this fact make hashing useful for?
Storing passwords:
1.Instead of storing the password directly, the system generates a hash of the password using a hashing algorithm
2.The system stores the hash in the database, not the password itself.
3.When a user enters their password, the system hashes the input and compares it to the stored hash. If they match, the password is correct.
A hacker would only get accessed to the hashes which can’t be reversed to gain passwords (keys)
What would be the time complexity for looking up data in an array?
O(1) Constant
What is meant by a collision in hash tables?
Give methods to deal with these?
When 2 pieces of data produce the same hash
-Making a new/bigger hash table
-Storing items with same hash in a list under same hash value
-Use a second hash function to generate a new hash
A good hash function should…..
-Have a low chance of collisions
-Produces a fixed length output regardless of input size
What is a hash table?
A data structure which holds key-value pairs
A relational database is a database that….
database that recognises the differences between entities by creating different tables for each entity