Title: CSC 335 Data Communications and Networking
1CSC 335 Data Communications and Networking
- Lecture 5 Error Detection, Error Correction, and
Data Security - Dr. Cheer-Sun Yang
2Motivation
- Error can occur during transmission.
- Signal can be distorted and cause sampling
errors. - Sender sends a 1101, receiver can receive 1001.
- How can a receiver be aware of that an error has
occurred? - Can the position of a single bit error be
identified? - The techniques are called error detection and
single bit error correction.
3Transmission Errors
- External electromagnetic signals - noise
- Transmission errors - attenuation
- Lost data timing
- But, before we talk about errors, we have to
understand how messages are actually organized
and sent.
4Protocol Data Unit
- Messages are transmitted in a unit called
protocol data unit (PDU). - The data unit at data link layer is called a
frame which is a block of data bits enclosing in
a beginning and ending character. The beginning
character is called the start of header (SOH) and
the ending character is called the end of
transmission (EOT) in our textbook.
5Data Frame
In fact, the header contains a FLAG, the address,
and some control information. There are also
several kinds of frames information,
supervisory, and others. Each information frame
is also identified by a sequence number.
6Data Frame
- Advantages If error occurs at the sender side,
the receiver will never receive the ending
character. When the sender sends the header
again, the receiver can synchronize easily. - Disadvantages
- overhead
- what if the data portion includes a character
identical to either the header or the ending
character?
7Bit Stuffing and Byte Stuffing
- Ideally, the frame header or the ending character
wont occur in the data block. - But, it could happen.
- Bit-oriented protocol uses bit stuffing to solve
the problem.
8Bit Stuffing
- Header 01111110
- In any data character, if there are 6 continuous
1 bits, the transmitter inserts an extra 1 bit
after the fifth 1 bit the receiver will reverse
the procedure.
9Byte Stuffing
- If any data block contains a SOH, EOT, or ESC
(escape), the transmitter also does the
following - SOH in data becomes ESC X.
- EOT in data becomes ESC Y.
- ESC in data becomes ESC Z.
10(No Transcript)
11Error Detection
- The ability to detect when a transmission error
has occurred is called error detection. - Additional bits should be added by the
transmitter for detecting errors at the receiving
side. - Parity Bit
- Value of parity bit is such that character has
even (even parity) or odd (odd parity) number of
ones - Disadvantage Even number of bit errors goes
undetected
12Parity Checking Analysis
- Single bit error can be detected by a single
parity bit. - For example, the original data bits include
11010100, the parity (even) bit is then 0. - The data bits and the parity bit will be sent
together as a unit to the receiver. - If there is an error at the second bit, the
receiver receives 100101000. The total number of
1s is not an even number. The receiver can claim
that the message is incorrect.
13Parity Checking (contd)
- Single bit error can be detected by a single
parity bit. - However, if two bits are transmitted incorrectly,
the parity checking may not detect them. - For example, data1101, parity bit 1
- If incorrect data 1011, parity bit 1 the
receiver cannot tell that this message is
incorrect.
14(No Transcript)
15Any Problem?
- Parity checking will detect any single-bit error.
- Is there any glitch?
- Yes.
- What?
16Single-Bit Error
- Suppose an error occurred because of a brief
power surge or static electricity whose duration
is a hundredth of a second. If the data rate is
64 Kbps, approximately 640 bits will be affected. - When many bits are damaged, we call this a burst
error. - Single-bit parity checking is very likely to
fail!!
17Single-Bit Error (contd)
- In general, if an odd number of bits change,
parity checking will detect the error. - If an even number of bits change, parity checking
will not detect the error. - The error detection rate is 50 which is not
acceptable for a communications network. - Does this mean that parity checking is useless?
Well, No! - It is the basis of more complex techniques. It is
also useful when single-bit error could happen.
18Double-Bit Error Detection
- How about using two parity bits one checks for
the bits in odd positions and another checks for
bits in even positions? - It is better but still not good enough Why?
- A_____________________________. (Exercise)
19(No Transcript)
20Burst Error Detection
- Perhaps we should take a look at how data bits
are actually transmitted. - A block of data bits are transmitted in a unit
called frame. We will talk about the concept of
data frame more in next lecture. - Lets assume that a frame looks like this for now.
21Data Frame with Parity Bits
22- Rather than sending all bits from one frame
together, we send them separately. Transmitting
just one bit of information is not very
efficient, however. - If there are more frames to be sent together, we
can send one bit from each frame together with
the parity bit of the new data frames. Fig 4.3
illustrates this principle.
23(No Transcript)
24- Instead of sending 10 5-bit frames with a parity
bit, we send each column (6 10-bit frames). - Now, suppose a burst error occurs and interferes
with one transmission. At most, one bit from each
original data frame is actually changed, and the
parity check will detect them. - How successful is this approach?
25- The only way a burst error affecting two columns
can go undetected is when either two bits or no
bits are actually changed in each (old) frame. - What is the probability that this error can occur
and will not be detected? - Suppose column i and j were affected. Suppose
that the bits from column i are affected
randomly. Now consider any bit from column j, it
is either correct or it is incorrect. Therefore
there is a ½ chance that an error occurs to two
bits in the same row.
26- If there are n bits in a column, there is a
probability of (1/2)n that either two or no bits
are changed in each row and the error goes
undetected. If n20, the probability that the
error will not be detected 1/1048576.
27Cyclic Redundancy Check
- A major disadvantage of previous method is the
cost of assembling and reassembling of the
frames. Also, the error can only be detected
after all frames are received. Then resending all
frames is very costly. - Is there a way to send a frame and determine
immediately whether there was an error? - Yes. CRC is more efficient although more
difficult to understand.
28Bit String Representation
The bit string 10010101110 is interpreted as
29(No Transcript)
30CRC Method
- We assume all computations are done using
modulo 2. - Given a bit string, append several 0s to the end
of it (we will specify how many and why later)
and call it B. Let B(x) be the polynomial
corresponding to B. - Divide B(x) by some agreed-on polynomial G(x)
(generator polynomial) and determine the
remainder R(x).
31CRC Method (contd)
- Define T(x) B(x) R(x). Later we will show
that T(x)/G(x) generates a 0 remainder and that
the subtraction can be done by replacing the
previously appended 0 bits with the bit string
corresponding to R(x). - Transmit T, the bit string corresponding to T(x).
- Let T represent the bit stream that receiver
receives and T(x) the associated polynomial. The
receiver divides T(x) by G(x). If there is a 0
remainder the receiver concludes TT and no
error occurred. Otherwise, the receiver concludes
an error occurred.
32Modulo 2 Addition
- 0 0 0
- 0 1 1
- 1 0 1
- 1 1 0 (with no carry)
- Modulo 2 means to take the remainder after
dividing by 2. - 2 mod 2 0
33Modulo 2 Subtraction
- 0 0 0
- 0 1 1 (with no carry) (why?)
- 1 0 1
- 1 1 0
34Exclusive OR and Modulo
2 Addition and Subtraction
35(No Transcript)
36(No Transcript)
37How CRC works?
Suppose that we need to send the bit string
1101011, and the generator polynomial is G(x)
x4x3 1. Step 1 Append 0s to the end of the
string. The number of 0s is the same as the
degree of the the generator polynomial. Thus the
string is (B) 11010110000.
38How CRC works? (contd)
Step 2 Divide B(x) by G(x). Find the
corresponding bit representation of the remainder
polynomial R(x). In our case 1010. Step 3 Find
T(x) B(x) R(x). (Remember using modulo 2
subtraction). Transmit the string T.
11010110000 B 1010
R --------------------------------
11010111010 T (FACT)
39How CRC works? (contd)
Step 4 At the receiving side, receiver divides
the string (received) by G(x). If the remainder
is not 0, the string is incorrect.
40(No Transcript)
41(No Transcript)
42(No Transcript)
43Summary of Cyclic Redundancy Check
- For a block of k bits transmitter generates n bit
sequence - Transmit kn bits which is exactly divisible by
some number - Receive divides frame by that number
- If no remainder, assume no error
- For math, see Section 4.3
44Hamming Code
- Retransmission takes time and is costly if
retransmission also fails. - Due to R. W. Hamming
- Single-bit error correction identifies the
position of the error bit - Multiple-bit error detection only detects that
multiple-bit error has occurred
45General Concept
- Insert some parity checking bit at in the bit
string instead of at the end. - The parity bits check the parity in some specific
location - If there is a single-bit error, the location can
be identified by the combination of these parity
bits.
46A Guessing Game
- You can think of one number from 1 to 15 (Dont
tell me what it is.) - Is the number in one of the following?
- 1, 3, 5, 7, 9, 11, 13, 15
- Is the number in one of the following?
- 2, 3, 6, 7, 10, 11, 14, 15
- Is the number in one of the following?
- 4, 5, 6, 7, 12, 13, 14, 15
- Is the number in one of the following?
- 8, 9, 10, 11, 12, 13, 14,15
47An Example
Data to send m1 m2 m3 m4 m5 m6 m7 m8
Hamming Code
p1 p2 m1 p3 m2 m3 m4 p4 m5 m6 m7 m8
P1 even parity for positions 1,3,5,7,9,11 P2
even parity for positions 2,3,6,7,10,11 P3 even
parity for positions 4,5,6,7,12 P4 even parity
for positions 8,9,10,11,12
48Position of Extra Bits
- 20 1 the 1st position
- 21 2 the 2nd position
- 22 4 the 4th position
- 23 8 the 8th position
- 24 16 the 16th position
49(No Transcript)
50(No Transcript)
51(No Transcript)
52Error Detection vs. Error Correction
- Which one is better?
- A Neither.
- Error correction requires more overhead time
and extra bits - Error detection requires retransmission.
53Error Control (next lecture)
- Detection and correction of errors
- Lost frames
- Damaged frames
- Automatic repeat request
- Error detection
- Positive acknowledgment
- Retransmission after timeout
- Negative acknowledgement and retransmission
54Data Security
- Encryption and Decryption
- Key Distribution and Protection
- Public Key Encryption
- Viruses, Worms, and Hackers
55Encryption and Decryption
- The idea is to disguise information so that
even if it does fall into the wrong hands, it
cannot be understood. - Caesar Cipher
- Poly-alphabetic Cipher
- Transposition Cipher
- Bit-Level Ciphering
- Data Encryption Standard
- Clipper Chip
56Key Distribution and Protection
- Merklers Puzzles
- Shamirs Method
57Public Key Encryption
- RSA Algorithm
- Digital Signatures
- Authentication Using Hash-Bashed Schemes
58Viruses, Worms, and Hackers
- Infecting Files
- Memory-Resident Viruses
- Virus Evolution
- Virus Sources
- The Internet Worm
- Computer Hackers
59Assignments
- Read Section 4.1 - Section 4.4.
- Homework