Write out the encrypted data from the vector to a new file

Assignment Help Computer Engineering
Reference no: EM131772489

Assignment

Goals

1. To use bitwise functions in a program. ?
2. To implement encryption of the data in a file. ?
3. To use the Vector class. ?
4. This is part of your final exam.

You are going to perform an encryption of the data in the file. The first step is to swap the bits in each character, but since the technique of swapping bits is based on the position of the letter in the file, the letter frequency should change, so the data is more secure. This is a breakable cipher.

Instructions

1. Open a text file containing any text you wish (provided it is appropriate for campus). Pick a printable character as the end of file marker such as # or $.

2. Read whitespace characters as well as printable characters from your file and read the entire file into a vector. Leave the original whitespace characters in the vector, do not add or remove any characters.

3. Process the vector one character at a time. You will need to keep track of their place in the vector.

4. For each character do the following:

a. Using the index of the character (count the places in the file).

i. For the characters with an even position in the file (those with an even index, 0th, 2nd, 4th, 6th, etc.):

1. Encrypt the character by switching the value in bits 2 and 4. a. Switch of bit places are as follows:

b. The encrypted value would be: 1110 0111

2. Use bitwise operations to do this.

3. Replace the original character with the encrypted character in your vector.

ii. For the remaining characters with an odd position in the file (those with an odd index, 1st, 3rd, 5th, etc.):

1. Encrypt the character by switching the value in bits 1 and 3. a. Switch of bit places are as follows:

b. The encrypted value would be: 1111 1001

2. Use bitwise operations to do this.

3. Replace the original character with the encrypted character in your vector.

b. Do this for all the characters in the file.

c. Add the end of file marker to the end of the vector but do not switch its bits.

5. Write out the encrypted data from the vector to a new file, e.g. output.txt.

6. The switched characters of printable characters should also be printable. Leave the whitespace in the vector, they will remain whitespace

7. I expect this to take under 300 lines of code including comments, do not embellish the requirements.

Testing and Output.

• Test your program with text files of length 0, 140 and 500 characters. Rename and keep the input and output files from each test. E.g. output1.txt

Reference no: EM131772489

Questions Cloud

What is the npv of the project : Assume all cash flows occur at the end of the year and all losses can be off set against other income. What is the NPV of the project on 12/31/15?
What is the legal capital of the corporation : A stockholder has raised the following questions: What is the legal capital of the corporation? At what average price per share has the preferred stock issued
How has wireless media affected telecommunication : How has wireless media affected telecommunication? What are some of the challenges to developing a system of communications based on wireless media?
Conclusions about the company trends : Pick a company, calculate and report the percentage increase or decrease in stock price - AKA rate of return.
Write out the encrypted data from the vector to a new file : Write out the encrypted data from the vector to a new file, e.g. output.txt. ?Replace the original character with the encrypted character in your vector.
Biggest advantage and disadvantage : What, in your opinion, is the one biggest advantage and disadvantage, respectively, of each possible exchange rate system for an emerging country?
Is there an arbitrage opportunity here : It is now January. The current interest rate is 3%. The June futures price for gold is 1246.30, while the December future price is 1251.
What type of cabling will need to be used : What type of topology? What type of cabling will need to be used? You will need to determine cabling, hardware and software needs.
Analyse a business policy or strategic management : TNE SIM336 - Understanding of the origins and various approaches to strategy and strategic management or the philosophical underpinning of a particular

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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