COMPUTERNETWORKSANDSECURITY–21CS2212
DEPARTMENT OF COMPUTER SCIENCE AND
ENGINEERINGSUBJECTCODE:21CS2212
COMPUTERNETWORKSANDSECURITY
ERROR DETECTION#2
Dateof theSession: / / TimeoftheSession: to
Learningoutcomes:
UnderstandtheimportanceofErrorControl.[stanford.edu]
UnderstandtheErrorDetectionmethods likeParity,Checksum,and CRC.
IN-TUTORIAL:
1. a) Jairus wants to send a frame data(M)= 1101010 to his friend Radhika. For
securitypurposes both the friends have chosen parity as error detection mechanism. Show
thecodeword that Jairus transmits to Radhika following even parity. Also show the
codewordwhenodd parity is followed.
Solution:
Codeword (Even Parity)
=Codeword(OddParity)=
b) Consider the below three cases where Radhika has received the codeword from
Jairus.Illustrate the action taken by Radhika in each of these cases assuming even parity
isfollowed.
Case1:11010100
Case2:11000100
Case3:11000110
Solution:
Case1Action:
1
COMPUTERNETWORKSANDSECURITY–21CS2212
Case2Action:
Case3Action:
2. Raju wants to send four frames of data to Ahmad. For security purposes Raju would
liketo follow two-dimensional parity error detection mechanism. Your task is to help Raju
incomputing two-dimensional parity and compute the codeword for the four frames of
datagivenbelow.
10101010 10110111 11011001 10010110
Solution:
2
COMPUTERNETWORKSANDSECURITY–21CS2212
3. Themessage 110010011 istobetransmittedusingthegeneratorpolynomial x3+1 toprotect it
from errors. Find the final data to be transmitted after performing CRC.
Alsocheckforerrors on thereceived datausing CRC.
Solution:
3
COMPUTERNETWORKSANDSECURITY–21CS2212
4. Abitstream10011101istransmittedusingthestandardCRCmethod.Thegeneratorpolynomial
is x3+1
a. Whatisactualbitstring transmitted?
b. Suppose the third bit from the left is inverted during transmission.
Howwill receiver detect theerror?
Solution:
The frame is 10011101. The generator is 1001. The message after appending three zeros is 10011101000. The remainder on
dividing 10011101000 by 1001 is 100. So, the actual bit string transmitted is 10011101100. The received bit stream with an error
in the third bit from the left is 10111101100. Dividing this by 1001 produces a remainder 100, which is different from zero Thus,
the receiver detects the error and can ask for a retransmission.
4
COMPUTERNETWORKSANDSECURITY–21CS2212
5
COMPUTERNETWORKSANDSECURITY–21CS2212
POST-TUTORIAL:
1. ConsiderthemessageM=101001011anddotheCyclicRedundancy
checkfortheabovemessageusing thefollowingdivisor polynomialx5+x3+x2+1.
Solution:
6
COMPUTERNETWORKSANDSECURITY–21CS2212
2. Forthegivenmessage11011101,findtheevenandoddparityandthenwriteapythoncode.
Solution:
(ForEvaluator’suseonly)
Comment of the Evaluator (if Evaluator’sObservation
Any) MarksSecured: outof
FullNameof theEvaluator:
Signature of the
EvaluatorDateofEvaluatio
n:
7
COMPUTERNETWORKSANDSECURITY–21CS2212
DEPARTMENT OF COMPUTER SCIENCE AND
ENGINEERINGSUBJECTCODE:21CS2212
COMPUTERNETWORKSAND SECURITY
ERRORCORRECTION#3
Dateof theSession: / / TimeoftheSession: to
Learningoutcomes:
Generalideaof whatErrorCorrectionis.
UnderstandandapplyHammingCodeand2-D(Multiple)Parity.[GATE-CS-2017]
IN-TUTORIAL:
1. a) ISRO is transmitting data-1011 to Chandrayan-2. For security reasons, ISRO wishes
tosend data by implementing the Hamming Code technique for the sake of error
detectionandcorrection(ifit isonebit error).HelpISRO inperforming theabove
b) A7-bit
hammingcodeisreceivedas1011101,assumeEvenparityandstatewhetherreceiveddata is
correct ornot. Ifnot locatetheerror bit?
c) Considerabinarycodethatconsistsonly fourvalidcodewordsasgivenbelow.
00000, 01011, 10101, 11110
Let minimum Hamming distance of code be p and maximum number of erroneous
bitsthatcan becorrected bythecodebeq.Thevalueof p andq are: _.
[GATE-CS-2017]
Solution:
8
COMPUTERNETWORKSANDSECURITY–21CS2212
9
COMPUTERNETWORKSANDSECURITY–21CS2212
10
COMPUTERNETWORKSANDSECURITY–21CS2212
POST-TUTORIAL:
1. Write a Menu driven program to generate hamming code for the given data that is
givenand if any hammingcode isgiven, you have to check the errors inthe code and
displaythe bit option=int(input('Press 1 for generating hamming code\nPress 2 for finding
errorinhamming code\n\t Enter your choice:--\n'))
Solution:
11
COMPUTERNETWORKSANDSECURITY–21CS2212
12
COMPUTERNETWORKSANDSECURITY–21CS2212
13
COMPUTERNETWORKSANDSECURITY–21CS2212
2. a) Data of 25 bits is arranged in 5X5 matrix (rows r0 to r4 and columns d5 to d1) and
ispadded with column d0 and row r5 of parity bits computed using odd party scheme.
Eachbitofcolumnd0(respectivelyrowr5)givestheparityofthecorrespondingrow(respectively
,column). These36 bitsaretransmittedover thedata link.
D5 D4 D3 D2 D1 D0
R0 1 1 0 0 1 0
R1 1 0 1 1 1 0
R2 1 1 1 0 0 1
R3 0 0 1 0 0 0
R4 0 1 1 1 0 0
R5 0 0 0 1 0 0
Checktheabovetableandfindtheerrors,ifany.Writedowntheminimumpossiblenumberofcorrupte
dbits.
b) Five packets of data, each packet containing 7 bits to be transmitted over the internet
usingthe even parity. Append the parity bits using 2D parity with even parity, append all the
paritybitsto thisfollowing data.
Given data
isFrame1:1011101
Frame2:1110111
Frame3:1010101
Frame4:1111011
Frame4:1100001
Solution:
14
COMPUTERNETWORKSANDSECURITY–21CS2212
(ForEvaluator’suseonly)
Comment of the Evaluator (if Evaluator’sObservation
Any) MarksSecured: outof
FullNameof theEvaluator:
SignatureoftheEvaluator
DateofEvaluation:
15
COMPUTERNETWORKSANDSECURITY–21CS2212
16