What makes xor useful for basic encryption

Assignment Help C/C++ Programming
Reference no: EM131566986

Assignment: File Encryption

The XOR operator is something we had not yet introduced in class. It works on the bits that make up the binary representation of a variable, rather than the value of the variable. For example, each char is 1 byte, or 8 bits. XOR looks at the corresponding bits in each value and creates a new value. If the two bits in the values were different, the output will have a 1 in that position. If the two were the same, the output has a 0 in that position.

1477_XOR-Class.jpg

What makes XOR useful for basic encryption is that the operation is reversible. By using XOR again with the key and the encrypted data, we get the original as output. While this is very easy to implement, keep in mind that this is not very secure.

The XOR operator in C is used with the caret symbol, ^. Use it like you would a plus sign, with one operator on each side of it. It only works on ints and chars.

Your program must:

- Ask the user for the name of the file to encrypt/decrypt
- Ask the user for the name of the file to save the encrypted/decrypted file to
- Ask the user for the key to use
- Encrypt/Decrypt the file by reading it one character at a time, using XOR on that character with the next character in the key, and then writing that to the output file

o For example, if the key was "hello", the first character is XOR'd with ‘h', the second with ‘e', and so on, with the key repeating, so the 6th will also be XOR'd with ‘h'.

o You will need to use the binary file modes.

Reference no: EM131566986

Questions Cloud

Does the law violate the commerce clause : Does the law violate the Commerce Clause? Does the law violate the Fifth Amendment?
Dress code policy and procedures : Develop the dress code should be an Employee Dress Code, then evaluate the dress code policy and procedures for your current work.
How much interest does rachael earn on her investment : How much interest does Rachael earn on her investment?
Judgmental and mechanical methods : Judgmental and Mechanical Methods of Assigning Overall Performance Score at The Daily Planet
What makes xor useful for basic encryption : What makes XOR useful for basic encryption is that operation is reversible. By using XOR again with the key and encrypted data, we get the original as output.
How your department addresses rendering aid off duty : Discuss how the Arizona Supreme Court distinguished between on-duty and off duty. Do you agree with this distinction?
Summary contrasting law and ethics describing : Develop a 1,050-word summary contrasting law and ethics describing the following:
What monthly payment is required in order to pay off loan : What monthly payment is required in order to pay off the loan with 15 years of equal payments made at the end of each month?
Insurance marketing-distribution : Justabitof Insurance is considering to expand into State X. State X has open competition in very large commercial lines ($500,000 in premium or more).

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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