1.3.1 Compression, Encryption & Hashing Flashcards
What is compression?
A process used to reduce the storage space required by a file
What is the purpose of compression?
Increases the number of files that can be transferred in a given time
Reduce download time
Name two types of compression.
Lossy
Lossless
Describe lossless compression.
Reduces the size of a file less significantly as data isn’t removed
The original file can be recovered
Describe lossy compression.
Reduces the size of a file significantly by removing some data
The original file cannot be recovered
What is lossy compression suitable for?
Media
Not text/program files as characters will be removed
What is lossless compression suitable for?
Media but won’t reduce file size as significantly
Text/program files as can be recovered
What is Dictionary Encoding?
Method of lossless compression
Frequently occurring pieces of data are replaced with an index
Compressed data is stored with a dictionary which can be used to restore original data
What is Run Length Encoding?
Method of lossless compression
Repeated values replaced with one occurrence followed by number of repititions
Give two disadvantages of Run Length Encoding.
Relies on consecutive pieces of data being the same
Doesn’t offer much reduction in file size if little repitition
What is encryption?
A process used to ensure data is kept secure during its transmission
Data is scrambled before transmission and deciphered at its destination
What is asymmetric encryption?
Encryption used two keys
What is symmetric encryption?
Encryption using a single key
Describe what is meant by a key pair.
A public key that can be published anywhere
A private key that must remain secret
Both keys mathematically related
How does asymmetric encryption work?
Messages encrypted with the public key can only be decrypted with the corresponding private key
How does symmetric encryption work?
Both sender and receiver share the same private key
The key is distributed by key exchange and is used for both encryption/decryption
Why can symmetric encryption be less secure?
If the key is intercepted, communications can be intercepted
What is hashing?
An input is turned into a fixed size value (hash) by an algorithm
Why is storing password using hash functions secure?
The output cannot be reserved to gain the initial input
What is a salt?
A random value added to the input of a hash function to create an unique output
What is a hash table?
A data structure that holds key-value pairs that can be used to look up data in an array in constant time
What is constant time?
The time complexity O(1)
List the 4 features needed to be a good hash function.
Take any length input & produce fixed length output
Be efficient & fast to compute
Be computationally infeasible to invert
Have a low chance of collision
What is a collison?
A collison is said to have occurred if two keys produce the same hash
Describe two methods to overcome collisons.
Storing items together in a list under the hash value
Using a second hash function to get a new hash