1.3.1 Compression, Encryption and Hashing Flashcards
What is Compression
- Reducing the amount of storage space (bits) a given file takes up
- Removes unnecessary bits to reduce the overall size of the file
What are the advantages of compressing files
- Reduces the file size
- Reduces download times
- Reduces storage requirements
- Makes better use of bandwidth
How is the level of compression measured
- Compression ratio
- Size of the compressed file/ size of original file
- Number between 0 and 1. The closer to 0 the better
What are the 2 types of compression
- Lossy
- Lossless
What is Lossy Compression
- File is compressed to a smaller size bust some information is lost during the process
- The original file can’t be perfectly reconstructed
What is Lossless Compression
- Able to reduce a file’s size without losing any information.
- Original file can be perfectly restored
When is lossy and lossless sutiable
- Lossy provides better compression ratio - better if lost data isnt important - good for compressing images. unnoticeable reduction in quality
- Text documents and executable programs - can’t lose data during compression - use lossless
What is Run length encoding
- Method of lossless compression
- When a single character will be repeated many times
- R.L.E replaces a sequence of repeated characters with a flag character, (£,$) character itself, number of times its repeated
What is Dictionary Encoding
- Another form of lossless compression best for text-based documents
- Works by building an index that we visualise as a table - dictionary index
- Sequence of occurences of characters is created
What is Huffman Encoding
- One of the easiest dictionary encoding methods.
- Huffman encoding uses a dictionary to store all the letters that occur in text.
- Each letter is given a unique code, most common letters given a shorter code
What is Encryption and Decryption and name an example of a encryption algorithm
- Encryption: The act of scrambling a piece of plain text into cipher text so it cant be easily understood
- Decryption: Unscrambling encrypted message to reveal original text.
- Piece of information needed to decrypt message is the key.
- Caeser Cipher
Why is Caeser Cipher bad
- The shift cipher is weak
- Modern computers could use brute force hacking to crack it.
What is Symmetric Encryption
- The process of decryption is simply the opposite of the process used to encrypt
- e.g Caeser Cipher : replacing letters with letters a set number of places down the alphabet
- They are quick to set up and easy to execute but they are very weak (easily cracked)
What is Asymmetric Encryption
- The encryption and decryption keys are different
- If someone knows the encryption key they can encrypt the information but not decrypt it
- If someone has decryption key - can read info but not encrypt their response using the same algorithm.
- Also known as public key encryption
What is a key pair
- In assymetric encryption - the keys are generated so anything encrypted with 1 key can be decrypted with the other - key pair
- 1 key needs to be made into a public key and the other becomes the private key
- The public key can be published online and the private key should not be given to anyone.
What is a problem of using public key encryption and how should you solve this
- Someone could intercept Adam’s message and randomly remove chunks of the encoded message before passing it on to Charlotte. She wouldnt know if she had recieved the right message
Describe an example of using the asymmeric encryption
- Paul wants to send a message to Sarah
- Sarak keeps her decryption key secret (private key) and publishes her encryption key (public key)
- Paul uses the public key to encrypt the message
- Sarah uses her private key to decrypt the message
What is the RSA cipher and who invented it
- The asymmetric key was invented by American Computer Scientist Whitfield Diffie in 1975
- Ron Rivest, Adi Sharmir and Leonard Adelman developed the function for the encryption called the RSA Cipher and became the foundation for all ancryption techniques
What is Hashing
- A hash is a unique string of data
- Transforms a string of characters into a fixed length value or key that represents the original input string.
- In public key encryption, the hash is unique to the original message sent and can be used to confirm the integrity of information
What is the difference between encryption and hashing
- The difference is that hashing is a one-way process
- you can’t get back to the original value from the hashed value even if you have access to the original hashing algorithm.
- A slight change in the input message generates a different hash value
What are the 2 algorithms that a hash uses and what are the advantages of hashing
- SHA-1 and MD5
- Preventing information like passwords from being read
- Harder to access as they are unreadable
- As hash is 1 way, the hacker can’t obtain any actual passwords from the information in the file.
What is a digital signature
- Commonly used for software distribution, financial transactions
- 1 of the most common digital signature mechanisms is the digital signature algorithm (DSA)
- DSA lets 1 person with the private key sign the document so that others with a matching public key can verify that it was signed by the holder of the private key
- Digital signatures are usually applied to the hash of a message to add more security.
Exam Question) Explain why asymmetric encryption is more suited to transactions over the internet that symmetric encryption
- Symmetric encryption would require both parties to have a copy of the key
- This couldn’t be transmitted over the internet or an eavesdropper monitoring the message may see it
- Asymmetric gets round this requirement as there are 2 different keys.
- One key encrypts which can be publicly distributed
- And a different key to decrypt it which is kept private.
Exam Question) Explain the difference between lossy and lossless compression
- Lossy compression achieves a higher compression ratio but some data is lost
- Lossless compression retains all the original data but compression ratios are lower
Exam Question) What is meant by Symmetric Encryption and give an example of a symmetric encryption algorithm
- Type of encryption where the same key is used to encrypt and decrypt the data.
- The substitution or Ceaser Cipher
Exam Question) What is meant by asymmetric encryption
- The encryption and decryption keys are different
- For example RSA Cipher
Exam Question
- Other than encryption give 1 use of a hash function
- Describe what is meant by the term “hash”
- Hash functions can be used to create digital signatures
- A result generated by applying an algorithm/ numeric process to a value
Exam Question) Describe 1 advantage to storing passwords as a hash
- Hash functions are 1 way/ can’t be reversed
- If someone gains access to the database they cant access user’s password
Exam Question: Explain 2 characteristics of the hashing algorithm
- Low chance of collision (i.e. different inputs giving same output) (1 – AO1.2)
- to reduce risk of different files being marked as the same (1 – AO2.1)
- Quick to calculate (1 – AO1.2)
- as lots of files need to be hashed / needs to be quicker than a bitwise comparison to make it worthwhile (1 – AO2.1).
- Provides a smaller output than input (1 – AO1.2)
- so quicker to compare hashes than original data (1 – AO2.1).