Compression, encryption and hashing Flashcards
Exchanging data
Define compression
The process of making files smaller by representing then using less data. Making data quicker to transmit over a connection
What is lossy compression
- Info is removed
- Usually used in video/audio files (changes might include removing frequencies of sound the human ear won’t notice)
The higher the compression ratio the smaller the file has been made
What is lossless compression
- No info is removed
- The reconstructed version of the compressed file will be the same bit for bit
What are the two types of lossless compression
- Run-length encoding (RLE)
- Dictionary coding
Describe how run length encoding works
This makes use of redundant data
- If a data item occurs more than once consecutively the item is stored once in an index along with how many times it is repeated
Describe how dictionary coding works
An index is built where each data item is recorded along with an index reference
The compressed file contains the dictionary and the sequence of occurrences
Define encryption
The process of making data unreadable to third parties
What is a key
A value that needs to be provided to encrypt/decrypt data
How does encryption generally work
- Apply the encryption algorithm to the original data using the key so it is no longer readable
- The recipient applies the decryption algorithm using the key to decrypt the data
The key is kept secret
Define symmetric encryption
Encryption where the same key is used to encrypt and decrypt the data
Define asymmetric encryption
Encryption, where one key (the public key) is used to encrypt the data and another (the private key), Is used to decrypt it
What is a Hash function
A function that takes in data of any size and returns a fixed-length output
What are the properties of a hash function
- Irreversibility
- Determinism
- Collision resistance
Define Irreversibility (hashing)
It is impossible to calculate what data was put into the hash function given its output
define Determinism (hashing)
The same input will always give the same output
Define Collision resistance (hashing)
Reduced probability that two or more inputs will give the same output
describe some of the uses of hashing
Protects passwords stored on a database in case it gets hacked
- The password entered and compared to the stored hash
- If they are the same access is granted
Proof of state
- This can be used in police investigations to see if a database has been tampered with
What are hash tables
A data structure designed for fast access of data. Each piece of data is stored using a key
- The key is hashed into a memory location
- When they need to retrieve the data they hash the key again to get the location in which the data is stored