1.3.1 Compression, Encryption and Hashing Flashcards
what is the purpose of compression?
- reduce file size
- reduce download times
- reduce storage requirements
- make best use of bandwidth
why is making the best use of bandwidth important?
- large amounts of data are streamed and sent over the internet so using bandwidth efficiently is critical
what is compression?
reduction of the overall size of a file
what are two methods of compression?
- lossy
- lossless
what needs to happen to a compressed file to read it?
it needs to be uncompressed
what is lossy compression?
reduction of file size by permanently deleting data/reducing the quality of the data
what is lossless compression?
reduction of the file size by storing the data in a different, more compressed way
this means the overall quality of the data does not change
which types of data cannot be compressed with lossy compression?
text documents
executable programs
what are two methods of lossless compression?
- dictionary coding
- run-length encoding
what is dictionary coding good for?
text-based documents
what is run-length encoding more suited for?
images
how does dictionary coding work?
- builds an index
- every data item or entry in the file is recorded, along with an indexed reference or unique code
- file consists of dictionary index + sequence of occurrences needed to recreate original file
how does run-length encoding work?
- if there are lots of contiguous pixels of the same colour, the number of pixels of that colour can be stored rather than storing them individually
- it is stored in frequency/data pairs
what is encryption?
the process of encoding a message so that it can be read only by the sender and the intended recipient
how does symmetric encryption work?
- a single key is used to both encrypt and decrypt a message
- both parties need to know the key and keep it secret
how can the message be cracked with symmetric encryption?
- interception of the key
- duplication of the key production process to acquire a copy of key
How does asymmetric encryption work?
- use two different keys
- encrypt the message with the first key
- message is then decrypted with the second key after it is sent
What makes asymmetric encryption more secure?
- the two keys are not the same
- it is virtually impossible to derive one key from the other
what are ‘key pairs’?
keys that are generated so anything encrypted with one of the keys can be decrypted with the other
what is a public key as opposed to a private key?
- public key can be made public (give it out or publish online)
- anyone can have access to the public key
- PRIVATE key - not sent/shared with anyone
how does public/private key encryption work?
- each party has their own public/private key pairs
- sender + recipient exchange copies of their public keys
- sender uses the recipient’s public key to encrypt before sending
- recipient uses their private key to decrypt
what is another advantage of the public/private key method for encryption?
- someone can encrypt with their private key
- it can then be decrypted by their public key
- as the message can be decrypted with the public key, it must have originally been encrypted with the private key
- this confirms the message as authentic
what is a combined encryption key?
- when the sender’s private key and the receiver’s public key are used to encrypt a message
- it is then decrypted using the receiver’s private key and the sender’s public key
what 3 things do you know about a message when it is encrypted using asymmetric encryption?
- the sender and receiver know no one else can read the message
- you can be sure the message is authentic
- you can be sure the message hasn’t been modified
what is hashing/hashing function?
transforms a string of characters into a fixed-length value or key that represents the original input string
what does a hashing function contain?
an algorithm that converts the input data
eg. SHA-1, MD5
what happens to the hash value there is a slight change in the input message?
- produces a totally different hash value
- this is because the hash value is generated from the entire input message
what is the difference between hashing and encryption?
hashing is a one-way process.
you cannot get back to the original value from the hashed value, even if you have access to the original hashing algorithm
why is applying a hashing function to passwords secure?
- you do not have to send the passwords in plain text to the online system
- OR store the passwords in plain text in the online system
- any hacker who accesses the password file will only be able to see the hashed values (will not be able to obtain actual passwords as hashing is a one way process)
How are passwords verified if they have been hashed?
- hashing function is applied to the password entered
- system compares the hashed value to the one stored
how can hashing be used in data manipulation?
- used for quick searching, insertion and deletion of data in data structures
- there is no need to search the data structure for an entry
- just input what you are searching for and apply the hashing function to find item
what is the time complexity of hashing?
average - O(1)