Question
Need a JAVA program Consider a stream R of bits to send. An n-bit Internet Checksum of the stream S is computed as follows: 1)
Need a JAVA program Consider a stream R of bits to send. An n-bit Internet Checksum of the stream S is computed as follows: 1) Break the stream R of bits in n-bit words w1, w2, ..., and wm. 2) Compute the n-bit word S = w1 + w2, if there is a carry then set S = S + 1 3) Compute S = S + w3, if there is a carry then set S = S + 1 ........ n) Compute S = S + wn, if there is a carry then set S = S + 1 Finally, the Internet Checksum = ~S (one-complement of S) Example: suppose you must send the stream R = 01011100 01111010 00011010. To compute a 8-bit checksum, 1) Break the stream R of bits in 8-bit words w1, w2, ..., and wm. In this case, we will obtain: w1 = 01011100 and w2 = 01111010 w3 = 00011010 Go to Step 2.... Compute the n-bit word S = w1 + w2, if there is a carry then set S = S + 1 ..... How to check that your checksum is right?: if you add all words wi and the checksum, the sum should be equal to 111....1 (all ones).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started