Learn and use bitwise operations within a program

Assignment Help Computer Engineering
Reference no: EM132084492

Objective: it should be in C language

The purpose of this assignment is to learn and use bitwise operations. In this homework, as an option, you can find a partner in your class so you can work together to finish the homework. You don't necessarily need to meet each other in face.

Description:

Given an arbitrary text file, your program will pack the ascii code characters into integers. Specfically, 4 characters will be encoded into one unsigned integer.

Then, you modify your integer shifting it k bits in circle as an "encryption", where k is the shared key between you and your partner for the encryption and decryption.

After that, you save your integer into a binary file. Your partner's program will read the binary file, and decode the contents into the original text, and save the text in another text file.

If you don't want to work with a partner, that is fine. You can use my object file and header file to do either encoding or decoding.

Instructions:

Here are some basic components for your program design. To simplify the matter, we'll use HW8.txt as input file, HW8.bin as binary output, and HW8c.txt as text output.

1- In "encoding.c", you have a function "encoding" which opens the text fiile "HW8.txt" for reading and the binary file "HW8.bin" for wrting. Then, read 4 characters at a time, pack them into an integer by a function "pack", manipulate the integer by "encryption", and write the encrypted integer into "HW8.bin" until the end of "HW8.txt". At the end of file, you may save some NULL ('\0') characters to make it 4 characters for the last integer. Close all open files.

2- In "decoding.c", you have a function "decoding" which opens "HW8.bin" for reading and a text file "HW8c.txt" for writing. Then, read an integer at a time, use the key from your partner to manipulate the integer by a function "decryption", unpack it into 4 characters by a function called "unpack", and save the 4 characters into "HW8c.txt". Close all open files.

3- The "encryption" function will shift an integer k bits to the left (or right) in circle in "encoding.c". Here k is the secrete key you share with your partner. The "decryption" will restore the encryption process in "decoding.c". That is, shifting k bits to the right (or left) in circle.

4- If you work in team, one person implement "encoding.c" and the other implement "decoding.c". You can give your header file and object file to your partner (encoding.h and encoding.o, or decoding.h and decoding.o), but not the source code. Your key and direction of circlic shift should be described and shared in the header file.

5- Presumably, you don't have your partner's "c" file, but you link the object file your partner provides, so your Makefile will be just using an existing object file for linking. Of course, you may just link with my object file. Then, you don't have a partner.

6- Your "main.c" is simple: display the content of "HW8.txt", call encoding, call decoding, and display the contents of "HW8c.txt". You can display the content of a file by a system call as follows, for example: system ("cat HW8.txt");

7- You should have the corresponding header file(s) for compilation. Again, you don't share your source code, but you share the header file(s) and the object files. The key is described in the header file(s).

As you have previously done, create a typescript that prints your program to the screen, confirm the system you are on, run it, and submit the typescript, Makefile, and the source files containing your programs to Blackboard as HW 8. You only submit your own source code because you don't see your partner's source code. You need to submit your partner's object file you received from your partner.

Reference no: EM132084492

Questions Cloud

What were the goals of adolph hitler as laid out : What were the goals of Adolph Hitler as laid out in Mein Kampf? What were the ideological roots of the Nazi Party, and what kind of goals did the party
Discuss about the structured design : When an object-oriented design proceeds to the implementation stage, it is possible that some operations listed in the object table will be implemented.
Creating a simple slot machine using c programming : The machine should ask the user how much money he/she is willing to Bet per each round.
How does the os manage processes : How does the OS manage processes? Be able to name five OS management activities related to processes.
Learn and use bitwise operations within a program : Can find a partner in your class so you can work together to finish the homework. You don't necessarily need to meet each other in face.
Do research and write a paper on structured analysis : Nassi-Shneiderman structure charts (yes, that's Ben Shneiderman, before he became famous for his work in HCI).
What kind of problems faced the german government : What kind of problems faced the German government between 1919 and 1925? How did the way the war ended contribute to the weakness
Create three variables of string data type : Create three variables of String data type, called firstName, lastName, and fullName respectively;
Find a plate with name rose from a stack of ten plates : Find a plate with name Rose from a stack of ten plates Private stack plates;

Reviews

Write a Review

Computer Engineering Questions & Answers

  Convert the given floating-point numbers to decimal values

Convert the following IEEE single-precision floating-point numbers to their decimal values. Report the answers to three significant figures.

  What is the most significant advantage of the implementation

What is the most significant advantage of the implementation? What is the most significant disadvantage of the implementation? Provide a scenario where this method of threading will provide the best solution and explain why.

  Create a program called dataexercise.c

Create a program called dataExercise.c that declares the following variables and displays their values.

  Create and test an html document that is the home page

Create and test an HTML document that is the home page of a business, Tree Branches, Unlimited, which sells tree branches.

  What mean to take a systems view of a project

What does it mean to take a systems view of a project? How does taking the systems view of a project apply to project management.

  Project descriptionin this project you will work with a fax

project descriptionin this project you will work with a fax cover sheet an application letter and a resume. to complete

  Analyze running time of algorithm

Analyze running time of algorithm

  Develop a test program that triggers a change

Develop a test program that triggers a change in the statistics above, report them on standard output - Replace the second-chance LRU approximation algorithm in both the active and inactive lists with a counter-based clock algorithm.

  Explain how important are communication skills in project

Explain How important are communication skills in project management? Was Herb the right person to be assigned as project manager?

  Show the generation of the codeword at the sender site

Given the dataword 1010011010 and the divisor 10111 to a CRC generator.

  Write an application with three labeled text fields

Write an application with three labeled text fields, one each for the initial amount of a savings account, the annual interest rate, and the number of years.

  What is the best way to write down the value ''7564''

What is the best process to write the value '7564' and make it clear to the reader that the number should be interpreted as a hexadecimal value?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd