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

0% found this document useful (0 votes)
36 views12 pages

Chapter 2 Notes

Chapter 2 discusses data transmission methods, emphasizing the use of data packets for efficient communication over networks. It covers the structure of packets, the process of packet switching, and various transmission modes including simplex, half-duplex, and full-duplex. Additionally, it explains the Universal Serial Bus (USB) interface for device connectivity and the importance of error detection methods such as parity checks and checksums.

Uploaded by

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

Chapter 2 Notes

Chapter 2 discusses data transmission methods, emphasizing the use of data packets for efficient communication over networks. It covers the structure of packets, the process of packet switching, and various transmission modes including simplex, half-duplex, and full-duplex. Additionally, it explains the Universal Serial Bus (USB) interface for device connectivity and the importance of error detection methods such as parity checks and checksums.

Uploaded by

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

Chapter 2

Data Transmission
2.1 Types and methods of data transmission
1 (a) Understand that data is broken down into
packets to be transmitted

Data packets
Data sent over long distances is usually broken up into data packets (sometimes
called datagrams). The packets of data are usually quite small, typically 64KiB,
which are much easier to control than a long continuous stream of data. The idea
of splitting up data in this way means each packet can be sent along a different
route to its destination. This would clearly be of great benefit if a particular
transmission route was out of action or very busy. The only obvious drawback of
splitting data into packets is the need to reassemble the data when it reaches its
destination.

1 (b) Describe the structure of Data Packets

Packet structure
A typical packet is split up into:
» a packet header
» the payload
» a trailer

For each packet, the packet header consists of:


» the IP address of the sending device
» the IP address of the receiving device
» the sequence number of the packet (this is to ensure that all the packets can
be reassembled into the correct order once they reach the destination)
» packet size (this is to ensure the receiving station can check if all of the
packets have arrived intact).
(Note: the header often also contains another value indicating how many packets
there are in total for this transmission.)
For each packet, the payload consists of the actual data being sent in the packet
(this is usually about 64KiB).
For each packet, the packet trailer consists of:
» some way of identifying the end of the packet; this is essential to allow
each packet to be separated from each other as they travel from sending to
receiving station
» an error checking method; cyclic redundancy checks (CRCs) are used to check
data packets:
– this involves the sending computer adding up all the 1-bits in the payload
and storing this as a hex value in the trailer before it is sent
– once the packet arrives, the receiving computer recalculates the number of
1-bits in the payload
– the computer then checks this value against the one sent in the trailer
– if the two values match, then no transmission errors have occurred;
otherwise the packet needs to be re-sent.

1 (c) Describe the process of packet switching

Packet switching
Packet switching is a method of data transmission in which a message is broken
up into a number of packets. Each packet can then be sent independently
from start point to end point. At the destination, the packets will need to be
reassembled into their correct order (using the information sent in the header).
At each stage in the transmission, there are nodes that contain a router. Each
router will determine which route the packet needs to take, in order to reach its
destination (the destination IP address is used in this part of the process).

How it works?
» each packet will follow its own path (route)
» routers will determine the route of each packet
» routing selection depends on the number of packets waiting to be processed
at each node
» the shortest possible path available is always selected – this may not always
be the shortest path that could be taken, since certain parts of the route may
be too busy or not suitable
» unfortunately, packets can reach the destination in a different order to that in
which they were sent.
Figure 2.5 on book page 47 shows one possible scenario. Notice the different paths
taken by
each packet from computer ‘A’ to computer ‘B’. Also notice that the packets have
arrived in a different order compared to the way they were sent, namely:
Computer ‘B’ will now have to reassemble the packets into the original sequence.

The benefits of packet switching are:


» there is no need to tie up a single communication line
» it is possible to overcome failed, busy or faulty lines by simply re-routing
packets
» it is relatively easy to expand package usage
» a high data transmission rate is possible.

Drawbacks
» packets can be lost and need to be re-sent
» the method is more prone to errors with real-time streaming (for example, a
live sporting event being transmitted over the internet)
» there is a delay at the destination whilst the packets are being re-ordered.

Lost Packets
Sometimes it is possible for packets to get lost because they keep ‘bouncing’
around
from router to router and never actually reach their destination. Eventually the
network would just grind to a halt as the number of lost packets mount up,
clogging up the system. To overcome this, a method called hopping is used. A
hop number is added to the header of each packet, and this number is reduced
by 1 every time it leaves a router (Figure 2.6).
Each packet has a maximum hop number to start with. Once a hop number
reaches zero, and the packet hasn’t reached its destination, then the packet is
deleted when it reaches the next router. The missing packets will then be flagged
by the receiving computer and a request to re-send these packets will be made.

Note: Hopping is not included in the syllabus.

2 (a) Describe how data is transmitted from one


device to another using different methods of
data transmission

Data transmission
Data transmission can be either over a short distance (for example, computer
to printer) or over longer distances (for example, from one computer to another
in a global network). Essentially, three factors need to be considered when
transmitting data:
» the direction of data transmission (for example, can data transmit in one
direction only, or in both directions)
» the method of transmission (for example, how many bits can be sent at the
same time)
» how will data be synchronised (that is, how to make sure the received data is
in the correct order).
These factors are usually considered by a communication protocol.

Simplex, half-duplex, full-duplex, serial and parallel data transmission

Simplex data transmission


Simplex mode occurs when data can be sent in ONE DIRECTION ONLY (for
example, from sender to receiver). An example of this would be sending data
from a computer to a printer.

Half-duplex data transmission


Half-duplex mode occurs when data is sent in BOTH DIRECTIONS but NOT AT
THE SAME TIME (for example, data can be sent from ‘A’ to ‘B’ and from ‘B’ to ‘A’
along the same transmission line, but they can’t both be done at the same time).
An example of this would be a walkie-talkie where a message can be sent in one
direction only at a time; but messages can be both received and sent.

Full-duplex data transmission


Full-duplex mode occurs when data can be sent in BOTH DIRECTIONS AT THE
SAME TIME (for example, data can be sent from ‘A’ to ‘B’ and from ‘B’ to ‘A’
along the same transmission line simultaneously). An example of this would be a
broadband internet connection.

Serial data transmission


Serial data transmission occurs when data is sent ONE BIT AT A TIME over a
SINGLE WIRE/CHANNEL. Bits are sent one after the other as a single stream.
Note: Serial data transmission can be simplex, half-duplex or full-duplex.
Serial data transmission works well over long distances. However, the data is
transmitted at a slower rate than parallel data transmission. Because only one
channel/wire is used, data will arrive at its destination fully synchronised (i.e.
in the correct order). An example of its use is when connecting a computer to a
printer via a USB connection (see Section 2.1.3).

Parallel data transmission


Parallel data transmission occurs when SEVERAL BITS OF DATA (usually one
byte) are sent down SEVERAL CHANNELS/WIRES all at the same time. Each
channel/wire transmits one bit:
(Note: Parallel data transmission can be simplex, half-duplex or full-duplex.)
Parallel data transmission works well over short distances. Over longer distances
(for example, over 20metres), data can become skewed (that is, the data can
arrive unsynchronised) and bits can arrive out of order. The longer the wire, the
worse this can become. It is, however, a faster method of data transmission than
serial. The internal circuits in a computer use parallel data transmission since
the
distance travelled between components is very short and high-speed transmission
is essential.

2 (b) Explain the suitability of each method of data


transmission, for a given scenario

Simplex :
We know that the message source is the transmitter, and the
destination is thereceiver. A channel whose direction of transmission is
unchanging is called as a simplex channel. In other words, a type of data
transmission, which is taken place only in one direction (from one antenna to the
other only), for example, a radio station is a simplex channel because it always
transmits the signal to its listeners and never allows them to transmit back.
A television set up can also be considered as the simplex type. The advantage of
simplex mode of transmission is, since the data can be transmitted only in one
direction, the entire band width can be used.

Half Duplex :
A half-duplex channel can be considered as a
single physical channel in which the direction may be reversed. Messages can
flow in two directions in a half-duplex type, but never at the same time. In other
words it can be said that at a single time, the transmission of data are done in
only one direction. For example, in a telephone call, one party speaks while the
other listens. After a pause (when one party stops his speech), the other party
speaks and the first party listens. Speaking simultaneously will result in a
garbled
sound that cannot be understood. The main difficulty of half-duplex mode of
transmission is since two channels are used, the band width of the channel should
be decreased.

Full Duplex :
A full-duplex channel can be used for transmitting
simultaneous message exchange in both directions. It consists of two simplex
channels, a forward channel and a backward (reverse) channel, linking at the
same points. The transmission rate of the reverse channel will be very slow if it
is
used only for flow control of the forward channel. The main problem of the full
duplex mode of transmission is, since we are using two channels, the band width
should be decreased.

Serial :
Serial transmission technology is increasingly used for the transmission of digital
data. A large number of up-to-date communications networks apply serial
transmission. The numerous applications include computer networks for
office communications, fieldbus systems in process, building and manufacturing
automation, Internet and, finally, ISDN.
Serial data transmission implies that one bit is sent after another (bit-serial)
on a single transmission line. Since the microprocessors in the devices process
data in bit-parallel mode, the transmitter performs parallel-to-serial
conversion, while the receiver performs serial-to-parallel conversion (Fig. 1).
This is done by special transmitter and receiver modules which are commercially
available for different types of networks.
Extremely high data rates are possible today so that the increased time consumption
required by this technology is accepted in most cases. The reductions in costs and
installation effort as well as user-friendliness, on the other
hand, are points not only for locally extended systems in favor of serial
data transmission

Parallel :
Data is sent much faster as parallel transmission can increase the transfer speed
by a factor of n over the serial transmission. A huge amount of data is to be
transmitted over connection lines. Parallel transmission can send information from
computer to printer. This method significantly saves time on sending and receiving
a signal, which makes it the fastest. The main disadvantage of such approach is the
need to provide numerous wires for each output channel.

3 Understand the universal serial bus (USB)


interface and explain how it is used to transmit
data

Universal serial bus (USB)


USB is an interface that connects a device to a computer. With this connection, the
computer sends or retrieves data from the device. USB gives developers a standard
interface to use in many different types of applications. A USB device is easy to
connect and use because of a systematic design process. Universal Serial Bus (USB)
is a common interface that enables communication between devices and a host
controller such as a personal computer (PC) or smartphone. It connects peripheral
devices such as digital cameras, mice, keyboards, printers, scanners, media
devices, external hard drives and flash drives. USB cable consists of a four-wired
shielded cable, with two
wires for power (red and black). The other two wires (white and green) are for data
transmission. When a device is plugged into a computer using one of the USB ports:

» the computer automatically detects that a device is present (this is due to a


small change in the voltage on the data signal wires in the USB cable)
» the device is automatically recognised, and the appropriate device driver
software is loaded up so that the computer and device can communicate
effectively
» if a new device is detected, the computer will look for the device driver that
matches the device; if this is not available, the user is prompted to download
the appropriate driver software (some systems do this automatically and the
user will see a notice asking for permission to connect to the device website).

A new type of USB connector, referred to as USB-C, is now becoming more


common in laptops and tablets/phones. This is a 24-pin symmetrical connector
which means it will fit into a USB-C port either way round. It is much smaller
and thinner than older USB connectors, offers 100 watt (20 volt) power
connectivity, which means full-sized devices can now be charged and it can
carry data at 10 gigabits per second (10 Gbps); this means it can now support
4K video delivery.
USB-C is backward compatible (to USB 2.0 and 3.0) provided a suitable adaptor is
used, and is expected to become the new industry standard (universal) format.

Benefits

Devices plugged into the computer are automatically detected and device drivers are
automatically loaded up.

Connections can only fit one way preventing incorrect connections being made.

It has become an industry standard, which means considerable support is available.

Can support different data transmission rates (from 1.5Mbps to 5Gbps).

No need for external power source since cable supplies +5V power.

USB protocol notifies the transmitter to re- transmit data if any errors are
detected; this leads to error-free data transmission.

It is relatively easy to add more USB ports if necessary, by using USB hubs.

USB is backward compatible (that is, older versions are still supported).

Drawbacks

Standard USB only supports a maximum cable length of 5m; beyond that, USB hubs are
needed to extend the cable length.

Even though USB is backward compatible,very early USB standards (V1) maynot always
be supported by the latest computers.

Even the latest version 3 (V3) and version 4 (V4) USB-C systems have a data
transfer rate which is slow compared to, for example, Ethernet connections (Note:
USB V2 has a maximum data transfer rate of 480Mbps.)

2.2 Methods of error detection

1 Understand the need to check for errors after data transmission and how these
errors can occur

Error

When data is transmitted, there is always a risk that it may be corrupted, lost or
even gained.
Errors can occur during data transmission due to:
» interference (all types of cable can suffer from electrical interference, which
can cause data to be corrupted or even lost)
» problems during packet switching (this can lead to data loss – or it is even
possible to gain data!)
» skewing of data (this occurs during parallel data transmission and can cause
data corruption if the bits arrive out of synchronisation).
Checking for errors is important since computers are unable to understand text,
for example, if the words are not recognised by its built-in dictionary.

Figure 2.13 could be the result of some data corruption


following transmission which would make the text unintelligible to a computer.
This is why error checking is such an important part of computer technology.
The following section considers a number of ways that can be used to check for
errors, so that you don’t end up with text as shown in Figure 2.13 above!
There are a number of ways data can be checked for errors following
transmission:
» parity checks
» checksum
» echo check.

2 Describe the processes involved in each of the


following error detection methods for detecting
errors in data after transmission: parity check
(odd and even), checksum and echo check

Parity checks
Parity checking is one method used to check whether data has been changed or
corrupted following data transmission. This method is based on the number of 1-bits
in a byte of data. The parity can be either called EVEN (that is, an even number of
1-bits in the byte) or ODD (that is, an odd number of 1-bits in the byte). One of
the bits in the byte (usually the most significant bit or left-most bit) is
reserved for a parity bit. The parity bit is set according to whether the parity
being used is even or odd.
For example, consider the byte:
1 1 0 1 1 0 0
parity bit
In this example, if the byte is using even parity, then the parity bit needs to be
set to 0, since there is already an even number of 1-bits in the byte (four 1-
bits).
We thus get:
0 1 1 0 1 1 0 0
parity bit
In this example, if the byte is using odd parity, then the parity bit needs to be
set to 1, since we need to have an odd number of 1-bits in the byte. We thus get:
1 1 1 0 1 1 0 0
parity bit
Before data is transferred, an agreement is made between sender and receiver
regarding which type of parity is being used. Parity checks are therefore being
used as a type of transmission protocol.

If a byte has been transmitted from ‘A’ to ‘B’, and if even parity is used, an
error
would be flagged if the byte now had an odd number of 1-bits at the receiver’s
end. For example (assuming even parity is being used):
byte being sent: 0 1 0 1 1 1 0 0
parity bit
byte being received: 0 1 0 0 1 1 0 0
parity bit
In this case, the byte received has three 1-bits, which means it now has odd
parity; while the sender’s byte was using even parity (four 1-bits). This means an
error has occurred during the transmission of the byte. The error is detected by
the recipient’s computer re-calculating the parity of the byte sent. If even parity
had been agreed between sender and receiver, then a change in parity in the
received byte indicates that a transmission error has occurred.

If two of the bits change value following data transmission, it may be impossible
to locate the error using parity checking.
Let us imagine we are transmitting the following byte, using even parity:
0 1 0 1 1 1 0 0
Suppose more than one bit has been modified during data transmission. This
means the byte could have reached the destination as any of the following:
0 1 1 1 1 1 0 1 six 1-bits
0 1 0 1 0 0 0 0 two 1-bits
0 1 0 1 0 1 1 0 four 1-bits
In all these cases, the byte has clearly been corrupted, but the bytes have
retained even parity. Therefore, no error would be flagged in spite of the
obvious errors in transmission. Clearly it will be necessary to have other ways to
complement parity when it comes to error checking to ensure errors are never
missed. One such method is called checksum – see the next section.
You should have concluded that any of the bits in question 2 (Activity 2.5) could
have been changed where there was a transmission error. Therefore, even though
an error has been flagged, it is impossible to know exactly which bit is in error.
One of the ways round this problem is to use parity blocks. In this method,
a block of data is sent and the number of 1-bits are totalled horizontally and
vertically (in other words, a parity check is done in both horizontal and vertical
directions). As the following example shows, this method not only identifies that
an error has occurred but also indicates where the error is.

Checksum
A checksum is a method used to check if data has been changed or corrupted
following data transmission. Data is sent in blocks, and an additional value,
called the checksum, is sent at the end of the block of data.
The checksum process is as follows:
» when a block of data is about to be transmitted, the checksum is calculated
from the block of data
» the calculation is done using an agreed algorithm (this algorithm has been
agreed by sender and receiver)
» the checksum is then transmitted with the block of data
» at the receiving end, the checksum is recalculated by the computer using the
block of data (the agreed algorithm is used to find the checksum)
» the re-calculated checksum is then compared to the checksum sent with the
data block
» if the two checksums are the same, then no transmission errors have occurred;
otherwise a request is made to re-send the block of data.

Echo check
With echo check, when data is sent to another device, this data is sent back
again to the sender. The sender’s computer compares the two sets of data to
check if any errors occurred during the transmission process.
As you will have no doubt worked out, this isn’t very reliable. If the two sets of
data are different, it isn’t known whether the error occurred when sending the data
in the first place, or if the error occurred when sending the data back for
checking.
However, if no errors occurred, then it is another way to check that the data was
transmitted correctly. In summary:
» a copy of the data is sent back to the sender
» the returned data is compared with the original data by the sender’s computer
» if there are no differences, then the data was sent without error
» if the two sets of data are different, then an error occurred at some stage
during the data transmission.

3 Describe how a check digit is used to detect


errors in data entry and identify examples of
when a check digit is used, including international
standard book numbers (ISBN) and bar codes

Check digits
A check digit is the final digit included in a code; it is calculated from all the
other digits in the code. Check digits are used for barcodes on products, such as
International Standard Book Numbers (ISBN) and Vehicle Identification Numbers
(VIN). Check digits are used to identify errors in data entry caused by mis-typing
or mis-scanning a barcode. They can usually detect the following types of error:
» an incorrect digit entered, for example 5327 entered instead of 5307
» transposition errors where two numbers have changed order, for example 5037
instead of 5307
» omitted or extra digits, for example 537 instead of 5307 or 53107 instead
of 5307
» phonetic errors, for example 13 (thirteen), instead of 30 (thirty).

There are a number of different methods used to generate a check digit. Two
common methods will be considered here:
» ISBN 13
» Modulo-11

Example 1: ISBN 13
The check digit in ISBN 13 is the thirteenth digit in the number. We will now
consider
two different calculations. The first calculation is the generation of the check
digit.
The second calculation is a verification of the check digit (that is, a
recalculation).
Calculation 1 – Generation of the check digit from the other 12 digits in a number
The following algorithm generates the check digit from the 12 other digits:
1 add all the odd numbered digits together
2 add all the even numbered digits together and multiply the result by 3
3 add the results from 1 and 2 together and divide by 10
4 take the remainder, if it is zero then use this value, otherwise subtract the
remainder from 10 to find the check digit.
Using the ISBN 9 7 8 0 3 4 0 9 8 3 8 2 (note this is the same ISBN as in Figure
2.15)

▲ Figure 2.16 ISBN


1 9 + 8 + 3 + 0 + 8 + 8 = 36
2 3 × (7 + 0 + 4 + 9 + 3 + 2) = 75
3 (36 + 75)/10 = 111/10 = 11 remainder 1
4 10 – 1 = 9 the check digit
So we end up with the following thirteen-digit number (which matches the number
shown in Figure 2.15)

9 7 8 0 3 4 0 9 8 3 8 2 (no check digit)

9 7 8 0 3 4 0 9 8 3 8 2 9 (including check digit)

Calculation 2 – Re-calculation of the check digit from the thirteen-digit number


(which now includes the check digit)
To check that an ISBN 13-digit code is correct, including its check digit, a
similar
process is followed:
1 add all the odd numbered digits together, including the check digit
2 add all the even number of digits together and multiply the result by 3
3 add the results from 1 and 2 together and divide by 10
4 the number is correct if the remainder is zero.
Using the ISBN 9 7 8 0 3 4 0 9 8 3 8 2 9 (including its check digit) from Figure
2.17:
1 9 + 8 + 3 + 0 + 8 + 8 + 9 = 45
2 3 × (7 + 0 + 4 + 9 + 3 + 2) = 75
3 (45 + 75)/10 = 120/10 = 12 remainder 0
4 remainder is 0, therefore number is correct

Note: You will not need to remember the steps shown in these algorithms; the steps
will be given to you, but it is important that you understand how to use an
algorithm to calculate or verify check digits.

Example 2: Modulo-11
The modulo-11 method can have varying lengths of number which makes it suitable
for many applications, such as product codes or VINs. The first calculation is the
generation of the check digit. The second calculation is a verification of the
check digit
(that is, a recalculation).
Calculation 1 – Generation of the check digit from the other digits in a number
(In this example, we will assume the original number contained only 7 digits.)
The following algorithm generates the check digit from the other 7 digits:
1 each digit in the number is given a weighting of 8, 7, 6, 5, 4, 3 or 2 starting
from the
left (weightings start from 8 since the number will become eight-digit when the
check digit is added)
2 the digit is multiplied by its weighting and then each value is added to make a
total
3 the total is divided by 11
4 the remainder is then subtracted from 11 to find the check digit (note if the
remainder is 10 then the check digit ‘X’ is used).
The example to be used has the following seven-digit number:
1 7-digit number: 4 1 5 6 7 1 0
weighting values: 8 7 6 5 4 3 2
2 sum: (8 × 4) + (7 × 1) + (6 × 5) + (5 × 6) + (4 × 7) + (3 × 1) + (2 × 0)
= 32 + 7 + 30 + 30 + 28 + 3 + 0
total = 130
3 divide total by 11: 130/11 = 11 remainder 9
4 subtract remainder from 11: 11 – 9 = 2 (check digit)
So we end up with the following eight-digit: 4 1 5 6 7 1 0 2

Calculation 2 – Re-calculation of the check digit from the eight-digit number


(which
now includes the check digit)
To check that the eight-digit number is correct, including its check digit, a
similar
process is followed:
1 each digit in the number is given a weighting of 8, 7, 6, 5, 4, 3, 2 or 1
starting from
the left
2 the digit is multiplied by its weighting and then each value is added to make a
total
3 the total is divided by 11
4 the number is correct if the remainder is zero
Using the 8-digit number: 4 1 5 6 7 1 0 2
1 weighting values: 8 7 6 5 4 3 2 1
2 sum: (8 × 4) + (7 × 1) + (6 × 5) + (5 × 6) + (4 × 7) + (3 × 1) + (2 × 0) + (1 ×
2)
= 32 + 7 + 30 + 30 + 28 + 3 + 0 + 2
total = 132
3 divide total by 11: 132/11 = 12 remainder 0
4 remainder is 0, therefore number is correct

4 Describe how an automatic repeat query (ARQ)


can be used to establish that data is received
without error

Automatic Repeat Requests (ARQs)


We have already considered parity checks and echo checks as methods to verify
that data has arrived at its destination unchanged. An Automatic Repeat
Request (ARQ) is a third way used to check data following data transmission.
This method can best be summarised as follows:
» ARQ uses positive and negative acknowledgements (messages sent to
the receiver indicating that data has/has not been received correctly)
and timeout (this is the time interval allowed to elapse before an
acknowledgement is received)
» the receiving device receives an error detection code as part of the data
transmission (this is typically a Cyclic Redundancy Check – refer to Section
2.1.1);
this is used to detect whether the received data contains any transmission errors
» if no error is detected, a positive acknowledgement is sent back to the
sending device
» however, if an error is detected, the receiving device now sends a negative
acknowledgement to the sending device and requests re-transmission of the data
» a time-out is used by the sending device by waiting a pre-determined amount
of time ….
» ... and if no acknowledgement of any type has been received by the sending
device within this time limit, it automatically re-sends the data until a
positive acknowledgement is received ….
» ... or until a pre-determined number of re-transmissions has taken place
» ARQ is often used by mobile phone networks to guarantee data integrity.
2.3 Symmetric and asymmetric encryption

1 Understand the need for and purpose of


encryption when transmitting data

The purpose of encryption

When data is transmitted over any public network (wired or wireless), there
is always a risk of it being intercepted by, for example, a hacker. Under
these circumstances, a hacker is often referred to as an eavesdropper. Using
encryption helps to minimise this risk.
Encryption alters data into a form that is unreadable by anybody for whom the
data is not intended. It cannot prevent the data being intercepted, but it stops it
from making any sense to the eavesdropper. This is particularly important if the
data is sensitive or confidential (for example, credit card/bank details, medical
history or legal documents) The original data being sent is known as plaintext.
Once it has gone through an
encryption algorithm, it produces ciphertext. Figure 2.18

2 Understand how data is encrypted using


symmetric and asymmetric encryption

Symmetric encryption

Symmetric encryption uses an encryption key; the same key is used to encrypt
and decrypt the encoded message. First of all, consider a simple system that
uses a 10-digit denary encryption key (this gives 1 × 1010 possible codes); and a
decryption key. Suppose our encryption key is:
4 2 9 1 3 6 2 8 5 6
which means every letter in a word is shifted across the alphabet +4, +2, +9, +1,
and so on, places. For example, here is the message COMPUTER SCIENCE IS
EXCITING (plaintext on the top line of Figure 2.19) before and after applying
the encryption key (forming the ciphertext shown on the bottom line of
Figure 2.19):
C O M P U T E R S C I E N C E I S E X C I T I N G
4 2 9 1 3 6 2 8 5 6 4 2 9 1 3 6 2 8 5 6 4 2 9 1 3
G Q V Q X Z G Z X I M G W D H O U M C I M V R O J

To get back to the original message, it will be necessary to apply the same
decryption key; that is, 4 2 9 1 3 6 2 8 5 6. But in this case, the decryption
process would be the reverse of encryption and each letter would be shifted –4,
–2, –9, –1, and so on. For example, ‘G’ -->‘C’, ‘Q’ -->‘O’, ‘V’ -->‘M’, ‘Q’-->
‘P’, and
so on.
However, modern computers could ‘crack’ this encryption key in a matter of
seconds. To try to combat this, we now use 256-bit binary encryption keys that
give 2256 (approximately, 1.2 × 1077) possible combinations. (Even this may not be
enough as we head towards quantum computers.)
The real difficulty is keeping the encryption key a secret (for example, it needs
to be sent in an email or a text message which can be intercepted). Therefore,
the issue of security is always the main drawback of symmetrical encryption,
since a single encryption key is required for both sender and recipient.

Asymmetric encryption
Asymmetric encryption was developed to overcome the security problems
associated with symmetric encryption. It makes use of two keys called the public
key and the private key:
» public key (made available to everybody)
» private key (only known to the computer user).
Both types of key are needed to encrypt and decrypt messages.
We will use an example to explain how this works; suppose Tom and Jane work for
the same company and Tom wishes to send a confidential document to Jane:
1 Jane uses an algorithm to generate a matching pair of keys (private and
public) that they must keep stored on their computers; the matching pairs of
keys are mathematically linked but can’t be derived from each other.
2 Jane now sends her public key to Tom.
3 Tom now uses Jane’s public key to encrypt the document he wishes to
send to her. He then sends his encrypted document (ciphertext) back to Jane.
4 Jane uses her matching private key to unlock Tom’s document and
decrypt it; this works because the public key used to encrypt the document
and the private key used to decrypt it are a matching pair generated on Jane’s
computer. (Jane can’t use the public key to decrypt the message.)

Jane can also exchange her public key with any number of people working in
the company, so she is able to receive encrypted messages (which have been
encrypted using her public key ) and she can then decrypt them using her
matching private key:

However, if a two-way communication is required between all five workers, then


they all need to generate their own matching public and private keys. Once this
is done, all users then need to swap public keys so that they can send encrypted
documents/files/messages between each other. Each worker will then use their
own private key to decrypt information being sent to them.

You might also like