Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Working with a program in c that reads in a file and then I have to do both 8 bit and 16 bit checksum for

Working with a program in c that reads in a file and then I have to do both 8 bit and 16 bit checksum for a program.I only have 8 bit checksum done so far.

This is what I understand

I read the file and store the information in an array of characters and at end it takes the newline feed. so for example to calculate 8 bit check sum this is what happens essentially

File has 3 letters total ( 3 a's and a newline feed)

so array holds 4 chars aaa+(newline) (97+97+97+10)

To my understanding I add all the bytes in the array then do % 256 and that is my checksum.

97 * 3 = //3 a's (small a ) pulled from ascii table from what I understand

291 + 10 = 301 // + newline

301 % 256 = cc in hex //

however I am getting confused on how to calculate the 16 bit checksum because I can't add 2 characters at a time if its a single character array? any help would be greatly appreciated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

=+ How well do you think you could do your job?

Answered: 1 week ago