Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
18 views23 pages

Chapter 2 Data Transmission

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views23 pages

Chapter 2 Data Transmission

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Data Packets

What are packets?


• Information on the internet is broken down into packets and are created
by TCP and transmitted over the internet
o Packets are small chunks of information/data
o TCP stands for Transmission Control Protocol and is used for
organising data transmission over networks
• Small chunks of data are easier and quicker to route over the internet than big
chunks of data
o Routing involves finding the most optimal path over a network
• Data can include anything from text, images, audio, video, animations, etc, or
any combination of these

What do packets contain?


• Packets are “chunks” of information. This information is called the “payload”
• Packets act like postage letters, each one has:
o a delivery address (destination IP address)
o a return address (source IP address),
o and a message (data payload)
• Packets are split into three parts:
o Packet header
o Payload (the actual data)
o Trailer
• The header contains:
o Source IP
o Destination IP
o Packet number
o Error checker e.g. a checksum or parity bit

• The trailer contains:


o Additional error checks
o End of packet notification
o
Figure 1: To transmit the message “This is a message :)” over the internet, the TCP might
break the message down into 4 packets

• Each packet in figure 1 contains a source IP address, destination IP address,


payload (the data) and a packet number. Error checking and end of packet
notifications have not been included in this example
• Individual packet structure depends on the protocol used to create them;
variations exist
• Error checks make sure that when a packet is received there is minimal or
no corruption of the data
• Corruption is where packet data is changed or lost in some way, or data is
gained that originally was not in the packet
• A parity bit checks that no bits have been flipped from 0 to 1 or vice versa
• A checksum performs a calculation and compares the result to the checksum
value. If the values are different then the data has been corrupted

How are packets sent across the internet?


• Sending packets over the internet is called packet switching and is more
efficient than circuit switching
• Packet switching involves:
o Routers know which nearby router is closer to the destination device
o Like normal car traffic, data traffic builds up on the internet. Routers can
see this and decide to send a packet down a different route that avoids
traffic.
o Packets from the same message can take different routes from the sender
to the receiver, and may arrive in different orders. The receiver's computer
reassembles the message by reordering the packets using the packet
numbers
o Breaking down a file into packets and sending these packets down
different routes over the internet (via routers) from a source to a
destination and reassembling them at the end
o Packet numbers allow for the original message, which has been broken
down into smaller parts, to be re-assembled in the correct order, or
assembled together like a jigsaw, once all of the packets have been
received
o Routers contain routing tables which keep track of nearby routers like a
map or contacts list
o If a packet does not reach its destination the receiver can send a resend
request to the sender to resend the packet

• The advantages of packet switching are:


o Interference and corruption are minimal as individual packets can be
resent if they are lost or damaged
o The whole file doesn’t need to be resent if a corruption occurs, only the
individual packets that were corrupted need to be resent. This saves time
and internet bandwidth
o Packet switching is quicker than sending a large packet as each packet
finds the quickest way around the network
o It's harder to hack an individual's data as each packet contains minimal
data, and travels through the network separately
Data Transmission
Wired connections
• Wires can be:
o Serial
▪ One bit is sent at a time across a single wire

• Parallel
o Multiple bits are sent at a time across several wires.
o Transmission is asynchronous as some bits may arrive quicker than
others. This is known as skewing or skewed data.
▪ Asynchronous transmission means data does not always arrive at
the same time
Figure 2: A sender sends a stream of bits in sequence, one after the other across multiple wires at
the same time

o Simplex
▪ Simplex transmissions are unidirectional and travel in only one
direction
o Half-duplex
▪ Half-duplex transmissions are bidirectional i.e. can travel in both
directions, but not simultaneously!
o Full-duplex
▪ Full-duplex transmissions are bidirectional but can transmit
signals in both directions at the same time
• Wires can be combinations of serial, parallel, simplex, half-duplex and full-duplex

Figure 3: Wire types can be combined between serial/parallel and simplex/half-


duplex/full-duplex

o Serial-Simplex
▪ Data is transmitted one bit at a time in a single direction on one
wire
o Serial-Half-duplex
▪ Data can be transmitted in both directions on a single wire but
only one bit at a time can be transmitted in one direction at a time
o Serial-Full-duplex
▪ Data can be transmitted in both directions at the same time on
a single wire one bit at a time
o Parallel-Simplex
▪ Multiple wires transmit one bit at a time in one direction
o Parallel-Half-duplex
▪ Multiple wires send multiple bits of data in both
directions but only one direction at a time
o Parallel-Full-duplex
▪ Multiple wires send multiple bits of data in both directions at
the same time

Advantages and disadvantages of each method


Example scenarios of using each method

• Serial
o Connecting an external hard drive to a computer
o Transmitting data over a telephone line
• Parallel
o Transmitting data from a computer to a printer using a multi-wire connector
• Simplex
o Transmitting data from a computer to a printer. The printer doesn’t need to send
data back to the computer
▪ Modern versions of devices such as printers may send acknowledgement
signals to confirm they have received the data. This may require half-
duplex rather than simplex connections
• Half-duplex
o Phone conversations where only one person needs to speak at a time
o A walkie-talkie is a two way radio with a push to speak button. The receiver is
turned off while the transmitter is turned on. This prevents you from hearing the
other person while you speak
• Full-duplex
o Broadband connections to the internet. Data must be sent and received at the
same time. Accessing information on the internet is known as downloading
information. Putting information onto the internet for others to access is known as
uploading
o Phone conversations where both people can talk and be heard at the same time
allowing them to interrupt each other
USB
• The Universal Serial Bus (USB) is an asynchronous and serial method of
transmitting data between devices and has become an industry standard
• Many devices use USB such as keyboards, mice, video cameras, printers,
portable media players, mobile phones, disk drives, network adapters, etc
• Different USB connectors exist for different devices. Some examples are:
o USB-A (flash drives, mice, keyboards, external HDD, etc)
o USB-B (printers, scanners, optical drives, floppy drives, etc)
o USB-C
• USB-C is becoming the new standard of USB due to its small size and speed

• When a device is connected to a USB port the computer is:


o Automatically detects that the device has been connected
o Automatically recognised and the appropriate device driver is
loaded so that the device can communicate with the computer
▪ If the device is new, the computer will look for a matching device
driver. If one cannot be found then the user must download and
install an appropriate driver manually

Advantages and disadvantages of USB


Error Checking
• When data has been received it could be subject to errors and Corruption

Why check for errors?


• Computers expect data in certain formats
o A format is a way of arranging the data so that it can be easily
understood by people and by computers
o People agree to certain formats so that systems work
more efficiently and there is little chance of misunderstanding each other
• An example of a format is date and time. Date and time can have multiple
formats such as:
o 13/04/14 (DD/MM/YY)
o 12/31/2020 (MM/DD/YYYY)
o Jul-04-16 (MMM/DD/YY)
• Computers usually perform processes and calculations on data. If the data is not
as expected, things can go wrong. For example, if a receiver expected to receive
a date in format DD/MM/YY as 03/04/17 but received 04/03/17, did the sender
mean 3rd April 2017 or 4th March 2017?
• An error or corruption occurs when data received is not as expected and
therefore is difficult or impossible to process

How is data represented?


• All data is represented in binary as 1’s (high voltage) and 0’s (low voltage)
o For example, the number 67 is represented as 01000011
o An error could cause one of the bits to flip from 1 to 0 or vice versa
o If the sixth most significant bit is flipped, 01000011 -> 01000111, 67
becomes 71
o The number 67 in ASCII represents the uppercase letter ‘C’ whereas the
number 71 represents ‘G’
o By flipping a single bit, the meaning of the binary string has changed
o If a book was transmitted over a network, assuming many bits were
flipped, it would likely be difficult to read the original text

How can errors cause problems?


• Some errors are small and trivial such as a single swapped letter in a large text
• Other errors, in data such as postage addresses, aerospace coordinates or bank
transfers, can be difficult to rectify or be disastrous
• Any job or task that relies on a computer to perform highly sensitive or secure
processes must have methods of error checking and correction

How do errors occur?


• Errors can occur using wired or wireless technology due to interference
• Examples of interference include wire degradation or electrical fields changing
the signal
• Results of interference include:
o Data loss - data is lost in transmission
o Data gain - additional data is received
o Data change - some bits have been changed or flipped
• Wireless technology uses radio signals or other electromagnetic signals to
transmit data
o These signals can be blocked by physical barriers such as buildings,
walls, cars or other objects
o Interference can be caused by bad weather such as rain or clouds, or by
other wireless signals or electromagnetic radiation
• Wired technology carries more chance of causing an error as physical
components can be damaged, degrade or receive interference from outside
signals
o Data loss can also occur from interruptions to data transmission such
as a blocked signal or if the transmission is intermittent
Error Detection Methods
Parity check
• The parity checking protocol determines whether bits in a transmission have
been corrupted
• Every byte transmitted has one of its bits allocated as a parity bit
• The sender and receiver must agree before transmission whether they are
using odd or even parity
• If odd parity is used then there must be an odd number of 1’s in the
byte, including the parity bit
• If even parity is used then there must be an even number of 1’s in the
byte, including the parity bit
• The value of the parity bit is determined by counting the number of 1’s in the
byte, including the parity bit
• If the number of 1’s does not match the agreed parity then an error has
occurred
• Parity checks only check that an error has occurred, they do not reveal
where the error(s) occurred

Even parity

• Below is an arbitrary binary string


• If an even parity bit is used then all bits in
the byte, including the parity bit, must add up
to an even number
o There are four 1’s in the byte. This
means the parity bit must be 0 otherwise the whole byte, including the
parity bit, would add up to five which is an odd number
Odd parity

• Below is an arbitrary binary string


• If an odd parity bit is used then all
bits in the byte, including the parity bit,
must add up to an odd number
o There are four 1’s in the byte.
This means the parity bit must be a 1 otherwise the whole byte, including
the parity bit, would add up to four which is an even number
• The table below shows a number of examples of the agreed parity between a
sender and receiver and the parity bit used for each byte

• Example #1: The agreed parity is odd. All of the 1’s in the main bit string are
added (5). As this number is odd already the parity bit is set to 0 so the whole
byte stays odd
• Example #2: The agreed parity is even. All of the 1’s in the main bit string are
added (1). As this number is odd the parity bit is set to 1 to make the total
number of 1’s even (2)
• Example #6: The agreed parity is even. All of the 1’s in the main bit string are
added (4). As this number is even already the parity bit is set to 0 so the whole
byte stays even

How do errors occur?


• When using parity bits, an error occurs when the number of total bits does not
match the agreed parity
• Bits can be flipped or changed due to interference on a wire or wirelessly due
to weather or other signals
• Example #1: The agreed parity is odd but the total number of 1’s is even (6). An
error has occurred somewhere
• Example #2: The agreed parity is even and the total number of 1’s is even (2).
No error has occurred here
• Example #3: The agreed parity is even but the total number of 1’s is odd (7). An
error has occurred somewhere
• Parity checks are quick and easy to implement but fail to detect bit swaps
that cause the parity to remain the same
• Below is an arbitrary binary string. The agreed parity is odd and the total number
of 1’s is five (odd)

Parity bytes and parity blocks


• Parity checks do not pinpoint errors in data, only that an error has occurred
• Parity blocks and parity bytes can be used to check an error has occurred and
where the error is located
o A parity block consists of a block of data with the number of 1’s
totalled horizontally and vertically
o A parity byte is also sent with the data which contains the parity bits
from the vertical parity calculation
• Below is a parity block with a parity byte at the bottom and a parity bit column in
the second column

• The above table uses odd parity


• Each byte row calculates the horizontal parity as a parity bit as normal
• Each bit column calculates the vertical parity for each row. This is the parity
byte. It is calculated before transmission and sent with the parity block
• Each parity bit tracks if a flip error occurred in a byte while the parity
byte calculates if an error occurred in a bit column
• By cross referencing both horizontal and vertical parity values the error can
be pinpointed
• In the above example the byte 3 / bit 5 cell is the error and should be a 0
instead
• The error could be fixed automatically or a retransmission request could be
sent to the sender

Checksums
• Checksums determine if data has been corrupted but do not reveal where
• Data is sent in blocks and an additional checksum value is added at the end
of the block
• Checksums are custom user-created algorithms that perform mathematical
calculations on data
• An example of a custom checksum algorithm in computer science is:
o A checksum byte is defined as a value between 1 and 255 which is
stored in 8 bits. 8 bits are collectively known as a byte
o If the sum of all of the bytes of a transmitted block of data is <= 255 then
the checksum value is the sum of all of the bytes
o If the sum of all of the bytes is > 255 then the checksum is calculated
with an algorithm:
▪ X = sum of all of the bytes
▪ Y = X / 256
▪ Round down Y to nearest whole number
▪ Z = Y * 256
▪ Checksum = X - Z

Custom Checksum Walkthrough



o If X = 1496
▪ Y = 1496 / 256 = 5.84
▪ Rounded down Y = 5
▪ Z = 5 * 256 = 1280
▪ Checksum = 1496 - 1280 = 216
o The checksum value in this example would be 216
• When a block of data is to be transmitted, the checksum is first calculated and then
transmitted with the rest of the data
• When the data is received the checksum value is calculated based on the received
data and compared to the checksum value received. If they are the same then the
data does not contain any errors
• If an error does occur then a resend request is sent and the data is retransmitted

Echo check
• Echo checks involve transmitting the received data back to the sender.
The sender then checks the data to see if any errors occurred during
transmission
• This method isn’t reliable as an error could have occurred when the sender
transmits the data or when the receiver transmits the data. Neither will know
when the error occurred.
• If an error does occur the sender will retransmit the data
Check Digits
• Check Digits to determine if data has been corrupted but do not reveal
where
• Data is sent in blocks and an additional check digit value is added at the end
of the block
• Check Digits are custom user-created algorithms that perform mathematical
calculations on data

• An example of a check digit is the ISBN value on books:


o Each book has a unique ISBN number that identifies the book
o A standard ISBN number may be ten digits, for example, 965-448-765-9
o The check digit value is the final digit (9 in this example). This number
is chosen specifically so that when the algorithm is
completed the result is a whole number (an integer) with no
remainder parts
o A check digit algorithm is performed on the ISBN number. If the result
is a whole number then the ISBN is valid

ISBN Check Digit Walkthrough



o
▪ To calculate an ISBN check digit the following algorithm is performed on
965-448-765-9:
▪ Multiply each ISBN digit by 1 to 10 and add them all up:
▪ 9x1 + 6x2 + 5x3 + 4x4 + 4x5 + 8x6 + 7x7 + 6x8 + 5x9 +
9x10 = 352
▪ Take the total number and divide it by 11: 352/11 = 32. 32 is
a whole number with no remainder so the ISBN is valid

• Another example of a check digit is barcodes on purchasable items:


o Barcodes consist of black and white lines which can be scanned using barcode
scanners. Barcode scanners shine a laser on the black and white lines
which reflect light into the scanner. The scanner reads the distance between
these lines as numbers and can identify the item
o Barcodes also use a set of digits to uniquely identify each item. The number
of digits varies from code to code. An example would be 9780201379624
o The final digit on a barcode is usually the check digit. Like an ISBN this can be
used to validate and authenticate an item

Barcode Check Digit Walkthrough



o To calculate a barcode check digit we can perform the following example
algorithm on 9780201379624 (the final digit is the check digit):
▪ Multiply each digit by 1 or 3, alternating between these two values and
add them all up
▪ 9x1 + 7x3 + 8x1 + 0x3 + 2x1 + 0x3 + 1x1 + 3x3 + 7x1 + 9x3 + 6x1
+ 2x3 = 96

▪ The check digit (the final digit) should be the difference between the sum
and the closest multiple of 10 that is larger or equal to the sum
▪ 96 rounded to the nearest 10 = 100
▪ 100-96 = 4
▪ The check digit is therefore 4 which matches our original barcode
number

• An example of a custom check digit algorithm in computer science is:


o A check digit byte is defined as a value between 1 and 255 which is stored in 8
bits. 8 bits are collectively known as a byte
o If the sum of all of the bytes of a transmitted block of data is <= 255 then
the check digit value is the sum of all of the bytes
o If the sum of all of the bytes is > 255 then the check digit is calculated with an
algorithm:
▪ X = sum of all of the bytes
▪ Y = X / 256
▪ Round down Y to a nearest whole number
▪ Z = Y * 256
▪ Check digit = X - Z

Custom Check Digit Walkthrough



o If X = 1496
▪ Y = 1496 / 256 = 5.84
▪ Rounded down Y = 5
▪ Z = 5 * 256 = 1280
▪ Check digit = 1496 - 1280 = 216
o The check digit value in this example would be 216

• When a block of data is to be transmitted, the check digit is first calculated and then
transmitted with the rest of the data
• When the data is received the check digit value is calculated based on the received
data and compared to the check digit value received. If they are the same then the
data does not contain any errors
• If an error does occur then a resend request is sent and the data is retransmitted

Automatic Repeat Request (ARQ)


• When the receiver receives transmitted data it must check for the presence of
any errors. Errors can usually be detected but not always pinpointed
• An Automatic Repeat Request is a protocol that notifies the sender that
an error has occurred and that the data received is incorrect. It works as
follows:
o If an error is detected the receiver sends a negative
acknowledgement transmission to indicate the data is corrupted
o If no error is detected the receiver sends a positive
acknowledgement transmission meaning the data is correct
o If the receiver does not send any acknowledgement
transmission then the sender waits for a certain time period known as
a time-out before automatically resending the data
o This process is repeated until all data has been received and
acknowledged

Encryption
• Many threats exist to system and network security. Examples include:
o Malware
o Viruses
o Spyware
o Hackers
o Denial of service attacks
o Social engineering
o SQL injection
• Hackers are people who try to gain unlawful or unauthorised access to
computers, networks and data by writing programs
• They look for weaknesses in the system and use them to gain access
• Hackers have various motives such as financial gain, a challenge or
protests etc
• Hackers sometimes target data in order to steal and use it, or block people
from using the data by creating programs called ransomware
• Hackers may also used packet sniffer to intercept and read data transmitted
across the internet or a network
• Hackers will often want to use people’s information and therefore it is beneficial
to encrypt your data

What is encryption?
• Encryption involves encoding data into a form that is meaningless using an
algorithm
o An example could be turning the phrase “Computer Science” into
“YekLKEZizFuFjHNCjHj3Md7qyTiGxLNNwPVFZtJU74I=”
• Once encrypted, data can be decrypted which turns the encrypted data into
data that can be understood again
• Encryption doesn’t prevent hackers from hacking but makes the data hard if
not impossible to understand unless they have matching decryption tools
• There are two types of encryption: symmetric encryption and asymmetric
encryption

Symmetric and asymmetric encryption


• Encryption relies on the use of a key. A key is a binary string of a certain length
that when applied to an encryption algorithm can encrypt plaintext information
and decrypt ciphertext
o Plaintext is the name for data before it is encrypted
o Ciphertext is the name for data after it is encrypted
• Keys can vary in size and act like passwords, enabling people to protect
information. A single incorrect digit in the key means the data cannot be
decrypted correctly. Strong modern keys can be up to or over 1000 bits long!

Symmetric encryption
• In symmetric encryption both parties are given an identical secret key which
can be used to encrypt or decrypt information
• Key distribution problem: If a hacker gains access to the key then they can
decrypt intercepted information
• Methods exist to send the secret key to the receiver without sending it
electronically:
o Both parties could verbally share the key in person
o Both parties may use standard postage mail to share the key (some
businesses and banks may do this to ensure someone's identity and
authenticity)
o An algorithm may be used to calculate the key by sharing secret non-
key information. An example is shown below

Symmetric Encryption Walkthrough

▪ Both parties A and B choose a number, for example A = 3, B = 2


▪ Both parties enter their own respective numbers into the following
equations: 7^A MOD 11 or 7^B MOD 11. ^ is another way of writing “to
the power of”
▪ 7^3 MOD 11 = 2, 7^2 MOD 11 = 5
▪ Both parties swap their respective answers. A receives 5 and B
receives 2. These answers replace the initial 7 number and the
calculations are performed again
▪ Both parties enter their new number into the following equations: 5^3
MOD 11 or 2^2 MOD 11
▪ 5^3 MOD 11 = 4, 2^2 MOD 11 = 4
▪ The answer should match for both parties and this becomes the encryption
and decryption key value
• Once the key is generated, it can be applied to the plaintext in the algorithm that
then produces the ciphertext which is sent to the receiver
• The receiver gets a copy of the ciphertext and the key and applies the encryption
algorithm. The algorithm then produces the original plaintext for the receiver

Asymmetric encryption
• In asymmetric encryption also known as public key encryption, two keys are
used:
o Public key: a key known to everyone
o Private key: a key known only to the receiver
• Both keys are needed to encrypt and decrypt information
• Asymmetric encryption works as follows:
o Person A uses a public key to encrypt their message
o Person A sends their message over the network or internet
o Person B decrypts the messae using their secret private key
• Asymmetric encryption works such that only one private key can be used to
decrypt the message and it is not sent over the internet like a symmetric key
• Keys can be very large, for example over 1000 bits. To get the correct key a
hacker would have to calculate almost every possible combination. To illustrate,
a key with only 100 bits would generate
1,267,650,600,228,229,401,496,703,205,376 different combinations

How are encryption keys created?


• Encryption keys can be created manually, randomly or via an algorithm
• Strong encryption keys are created using a hashing algorithm
• A hashing algorithm is a non-reversible mathematical algorithm that converts
a given input into an output. Once the output has been generated it is unable to
be converted back to the original input
• Encryption keys are created by supplying a message or key to the hashing
algorithm which turns it into a string of characters usually shown
in hexadecimal
• SHA-2 is an example of a hashing algorithm that creates hashed keys of 244,
256, 384 or 512 bit length
o If the text string “Computer Science” is run through the SHA-2 algorithm, it
would return a 512 bit key in hexadecimal as:
o “B6e175f5fc647b1a9ce17019594ce55b58e8fd03e3c584ee384121c8b4c7
753d”
• The hashed encryption key can then be sent symmetrically or kept secret as
part of an asymmetric private key. Both sender and receiver need a copy of
the key to decrypt information regardless of using symmetric or asymmetric
encryption

Why use hashed encryption keys?


• In symmetric encryption, the key must be sent with the message to the receiver.
If a hacker intercepts the key they can read the message
• In asymmetric encryption, the public key is available to everyone and would not
be useful to a hacker. The hacker must guess the private key in order to read
the message
• Hashing algorithms are many-to-one. This means that many input values,
messages or keys can produce the same hash key output
• A hashed encryption key means the hacker must first unhash the key before it is
useful
• As hashing algorithms are non-reversible this is extremely difficult
• With SHA-2 for example, a hacker who wants to find the symmetric or
asymmetric private key must calculate over 1.3x10^154 combinations; that is 13
with 153 0’s after it. With the computing power available today, this is virtually if
not actually impossible

You might also like