1.3.1 compression, encryption and hashing

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

compression

  • the process used to reduce the storage space required by a file, meaning you can store more files with the same amount of storage space

  • important for sharing files over networks or the Internet

  • the larger a file, the longer it takes to transfer and so compressing files increases the number of files that can be transferred in a given time

2
New cards

lossy compression

  • reduces the size of a file while also removing some of its information

  • this could result in a more pixelated image or less clear audio recording

  • for example, audio files can be compressed lossily by removing the very high or very low frequencies which are least noticeable to the ear

  • there’s no way to go from the lossy version of the recording back to the full version as there’s no record of what the high and low frequencies were

3
New cards

lossless compression

  • reduces the size of a file without losing any information

  • the original file can be recovered from the compressed version

4
New cards

run length encoding

  • method of lossless compression

  • repeated values are removed and replaced with one occurrence of the data followed by the number of times it should be repeated

  • the string AAAAAABBBBBCCC could be represented as A6B5C3.

  • in order to work well, run length encoding relies on consecutive pieces of data being the same

  • if there’s little repetition, run length encoding doesn’t offer a great reduction in file size

5
New cards

dictionary encoding

  • method of lossless compression

  • frequently occurring pieces of data are replaced with an index and compressed data is stored alongside a dictionary which matches the frequently occurring data to an index

  • the original data can then be restored using the dictionary

  • data compressed using dictionary compression must be transferred alongside its dictionary

<ul><li><p>method of lossless compression</p></li><li><p>frequently occurring pieces of data are replaced with an index and compressed data is stored alongside a dictionary which matches the frequently occurring data to an index</p></li><li><p>the original data can then be restored using the dictionary</p></li><li><p>data compressed using dictionary compression must be transferred alongside its dictionary</p></li></ul><p></p>
6
New cards

encryption def

  • a method used to keep data secure when it’s being transmitted

  • can be used to scramble data before it’s transmitted and then decipher it once it arrives at its destination

7
New cards

symmetric encryption

  • both the sender and receiver share the same private key, which they distribute to each other in a process called a key exchange

  • this key is used for both encrypting and decrypting data, so it’s important that the private key is kept secret

  • if the key is intercepted during the key exchange then any communications sent can be intercepted and decrypted using the key

8
New cards

asymmetric encryption

  • two keys are used: one public and a second, private, key

  • the public key can be published anywhere, while the private key must be kept secret

  • together, these keys are known as a key pair and are mathematically related to one another

  • messages encrypted with the recipient’s public key can only be decrypted with the recipient’s private key, which should only be in the possession of the recipient

9
New cards

hashing

transforms a string of characters into a fixed length value or key that represents the original string

<p>transforms a string of characters into a fixed length value or key that represents the original string</p>
10
New cards

uses of hashing

  • unlike encryption, the output of a hash function can’t be reversed to form the key

  • this quality makes hashing useful for storing passwords

  • a hash table is a data structure which holds key-value pair

  • a hash function can be used to lookup data in an array/hash table in constant time

  • when data needs to be inserted, it is used as the key for the hash function and stored in the bucket corresponding to the hash

11
New cards

collisions when using hashing

if two pieces of data (keys) produce the same hash, a collision is said to have occurred

12
New cards

hash table

  • utilises a key to index and retrieve data efficiently, providing fast access to stored values

  • goal is to immediately find an item a sorted or unsorted list without the need to compare other items in the data set

  • hashing function is used to calculate the position of an item in a hash table

13
New cards

overcoming a collision

  • open addressing - repeatedly check the next available space in the hash table until an empty position is found

  • linear probing - hashing function delivers the start position from which a linear search can then be applied until the item is found

    • prevents other items being stored in their correct location

    • clustering

  • rehashing

  • can increase the size of the hash table to avoid collisions

  • 2D hash table - two items can occupy the same position

  • use linked list / overflow table

14
New cards

properties of a good hashing function

  • calculated quickly

  • low chance of collisions

  • use the least amount of memory possible

15
New cards

operations on a hash table

  • add

  • delete

  • retrieve