Suoritettu

Checksum (8, 16, or 32 bits) in C (Code blocks)

You need to write a program that calculates the checksum for the text in a file. The program will take two command line parameters. The first parameter will be the name of the input file for calculating the checksum. The second parameter will be for the size of the checksum (8, 16, or 32 bits). The program must generate output to the console (terminal) screen as specified below.

Command Line Parameters

1. The program must compile and run from the command line.

2. The program executable must be named “checksum” (all lower case, no spaces or file extension).

3. Input the required file names as command line parameters. The program may NOT prompt the user to enter the file names. The first parameter must be the name of the file used for calculating the checksum, as described below. The second parameter must be the size, in bits, of the checksum. The sample run command near the end of this document contains an example of how the parameters will be entered.

4. The program should open the two files, echo the processed input to the screen, make the necessary calculations, and then output the ciphertext to the console (terminal) screen in the format described below.

Checksum size

The checksum size is a single integer, passed as the first command line argument. The valid values are the size of the checksum, which can be either 8, 16, or 32 bits. Therefore, if the first parameter is not one of the valid values, the program should advise the user that the value is incorrect with a message formatted as shown below:

printf("Valid checksum sizes are 8, 16, or 32\n");

The message should be sent to STDERR.

Format of the input file

The input file will consist of the valid ASCII characters associated with the average text file. This includes punctuation, numbers, special characters, and whitespace.

Output Format

The program must output the following to the console (terminal) screen:

1. Echo the input file

2. Print the checksum.

The echoed input text should be in rows of exactly 80 letters per row, except for the last row, which may possibly have fewer. These characters should correspond to the input text. The checksum line should be formatted as follows:

X bit checksum is Y for all ZZZ chars

Using the following:

printf("%2d bit checksum is %8lx for all %4d chars\n",

checkSumSize, checksum, characterCnt);

Where X is the checksum size of 8, 16, or 32 and the filename [login to view URL] is the input filename and Z is the calculated checksum. Note that the checksums are masked to print the appropriate sizes such two hex characters for 8 bits, 4 hex characters for the 16 bit checksum, and 8 hex characters for 32 bit checksum.

Program Notes

The program must read in an input text file that may contain uppercase letters, lowercase letters and non-letter characters. The program should then calculate the checksum appropriately for the size specified in the command line. Specifically, if the checksum is 8 bits long, each character should be used as the number to be added to the checksum. Likewise, if the checksum is 16 bits long, each two characters should be added to the checksum. Note that there is a 50% chance that there will be one character short on the input file. In that case use the character “X” (an uppercase X) as the pad character. Similarly, if the checksum is 32 bits, use the same technique and character to pad the input string appropriately.

Sample Run Command

Prompt$ ./checksum [login to view URL] 8

Taidot: C-ohjelmointi

Näytä lisää: 100 pwm bits pic code, libcurl dll code blocks, android code blocks, 32 bit checksum, fletcher 16 checksum c code, 16 bit checksum example, xor checksum, checksum algorithm, 16 bit checksum calculator, crc32, crc 16 ibm, code blocks stm32, code blocks, c code development for linux, c code review, c code se, c code to retrive, c code to write excel rows from a nested array, c code, c# code review

Tietoa työnantajasta:
( 0 arvostelua ) Miami, United States

Projektin tunnus: #19263663

Myönnetty käyttäjälle:

wangbeizou

Hello. How are you today. I have read and understood this task. I have a lots of experience and very good knowledge of Data structures, Algorithms Design, Computer Architecture. And I'm expert in C/C++, Python Lisää

$80 USD 1 päivässä
(90 Arvostelua)
5.8

7 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön

umg536

Hello there, This is a default bid made. we'll discuss the price later in the chat after reading your project i can do this for you perfectly.I still have a few questions. please leave a message on my chat so we can di Lisää

$155 USD 3 päivässä
(15 arvostelua)
6.0
liveexperts123

Hi there, I have read your project description and i'm confident i can do this project for you perfectly.I still have a few questions. please leave a message on my chat so we can discuss the budget and deadline of the Lisää

$155 USD 3 päivässä
(26 arvostelua)
5.6
Friends4it

Dear alexis1225, We have 10 different Point of Sale & ERP solutions including [login to view URL] [login to view URL] I am Good at C Programming.

$250 USD 8 päivässä
(2 arvostelua)
3.9
TalAkerele

Hi, I am very happy to bid your project. I read your requirements carefully,so i see what you mean. I have been experiments with C Programming,Php. I'd like to work with you. i'll complete this project for you to Lisää

$100 USD 1 päivässä
(12 arvostelua)
3.9
Ivan927

Hello! I am very interested in your post project. i have rich experience on it. I think this project is very suitable for me and i am sure i can give you good result . I can help you if you'd like looking forwar Lisää

$200 USD 3 päivässä
(3 arvostelua)
3.2
dungchan44

Hello, sir! I am happy to put my bid on your project. I have a full of experience with C program development. I have a team with 10 developers who have good skills in software development. We have finished many big Lisää

$88 USD 2 päivässä
(3 arvostelua)
2.6