Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Substitution cipher program in c++

28/10/2021 Client: muhammad11 Deadline: 2 Day

Encryption And Decryption C++ Language

CS150 Assignment 7 Cryptography

Date assigned: Monday, November 23, 2015 Date Due: Tuesday, December 8, 2015, 9:40 am (40 points) There is no late grace period for this last assignment!!!!! Cryptography is an exciting area of Computer Science concerned with hiding and protecting information. This is the branch of Computer Science that allows you to send your credit card securely to a web site or to decrypt or encrypt secret messages. For this project, you will be building a program that will take a plain text file and produce an encrypted file (or vice versa). The encryption scheme you need to implement is inspired by the Enigma Machine, a German encryption machine from WWII (http://en.wikipedia.org/wiki/Enigma_machine). The Enigma machine code was broken by Alan Turing and his team at Bletchley Park during World War II. Encryption Scheme: Simple substitution A simple substitution cipher (sometimes called a Caesar cipher) maps each letter of the alphabet to another letter of the alphabet as shown below:

To encrypt a letter, find the letter on the top and use the letter below it as the encrypted output. Using the above table, the encrypted output for C would be Z. To decrypt a letter, find the letter on the bottom and use the letter above it as the decrypted output. To make things more interesting, a secret key is used to specify how the input characters are mapped to output characters. The key, which is a single character, specifies which letter the output row starts on. The key in the above example is X. (The input row always starts with A). N-Way Substitution You will need to implement an N-Way substitution encryption scheme. This means you will have N substitution mappings. The character to be encrypted will be used as the input to the first mapping; the output of the first mapping will be the input to the second mapping. The output of the second mapping will be the input to the third mapping, etc. The output of the N-1 mapping is the input to the N mapping, and the output of the N mapping is the encrypted character. Each mapping has its own key, so you will have a total of N secret keys for this scheme. The value N, which is specified by the user, may be between 2 and 25. You must use a single, multidimensional array to represent all of these mappings.

Input A B C D E F G H I J K L M N O P Q R S T U V W X Y Z X Y Z A B C D E F G H I J K L M N O P Q R S T U V W Output

Encryption example (N = 2, keys of X and R): The initial input character of F gets mapped to C by the first mapping, and this becomes the input of the second mapping. Under the second mapping, this input character gets mapped to T which is the encrypted output character. Mapping 1: Input character: F (decrypted)

partial mapping array

Mapping 2: partial mapping array Output character: T (encrypted)

Decryption example (N = 2, keys of X and R): Decryption works in the opposite direction with the inputs and outputs reversed in each mapping. The input character of T gets mapped to C under the second mapping, and this becomes the input of the first mapping. Under the first mapping, this input character C gets mapped back to F which is the decrypted output character. Mapping 1: Output character: F (decrypted)

partial mapping array

Mapping 2: partial mapping array

Input character: T (encrypted) For this assignment, you need to allow the user to encrypt or decrypt as many files as they want. The user will need to specify the N keys and the input and output files. Your output must look exactly like the following (user input is in red): ******************** * ENCRYPTION ******************** Enter E)ncode, D)ecode, Q)uit: E Enter Number of Mappings (2-­‐25): 6 Enter the 6 keys: OREGON Enter plaintext filename: plaintext.txt Enter ciphertext filename: ciphertext.txt Encode Success Enter E)ncode, D)ecode, Q)uit: Q

Input A B C D E F G X Y Z A B C D Output

Input A B C D E F G R S T U V W X Output

Output A B C D E F G X Y Z A B C D Input

Output A B C D E F G R S T U V W X Input

Functions

You must use at least the following functions:

• void printHeading (const char heading[]); Description: Prints the heading as displayed on the sample output of the previous page.

• void getMappingData (int &numberOfMappings, char key[]); Description: Prompts the user for the number of mappings and the keys as displayed on the sample output. The number of mappings and keys are returned through the parameters numberOfMappings and key. To validate the key, you will need to use a string function called strlen, which returns the number of characters in the key. For example, the following program segment will allow the user to enter a key such as OREGON and then output 6. You will need to #include for the use of strlen. Remember, do not declare any string variables.

cin >> key; //Typing in OREGON produces a key OREGON\0 cout << static_cast(strlen (key)); // 6 is output

• void openFileForRead (ifstream &inputFile, const char message[]);

Description: Accepts a message to be displayed (e.g. Enter plaintext filename: ), then prompts the user to enter a plaintext file validating that the file exists and is open. Do not proceed until a proper file can be opened.

• void openFileForWrite (ofstream &outputFile, const char message[]); Description: Similar to openFileForRead only we are writing to a file.

• void constructMappingArray (char mappingArray[][LETTERS_IN_ALPHABET],

const char keyArray[], int numberOfMappings);

Description: Using the keyArray and numberOfMappings, you are to create the mappingArray as discussed above.

• void printMappingArray (const char mappingArray[][LETTERS_IN_ALPHABET], int numberOfMappings); Description: This function is simply for debugging. After you create the mappingArray, print it out to make sure you have a correct mappingArray. If not, there is no point in going on until this array is correct.

• char decodeCharacter (char ciphertextCharacter, const char mappingArray[][LETTERS_IN_ALPHABET], int numberOfMappings);

Description: Using the number of mappings and the mappingArray, this function takes an encoded character and returns a decoded character using the process described above.

• char encodeCharacter (char plaintextCharacter, const char mappingArray[][LETTERS_IN_ALPHABET],

int numberOfMappings);

Description: Using the number of mappings and the mappingArray, this function takes a plaintext character and returns a ciphertext character using the process described above.

• You can add more functions as you see fit. If you only use the functions described above, your main function might be a little long, say around 65 lines of code.

Part A (Due Wednesday, December 2, 2015 by 1pm) You are to implement the functions printHeading, getMappingData, openFileForRead, openFileForWrite, constructMappingArray, and printMappingArray. For part A only, display the mappingArray. You do not need to turn in a printed copy of your program for part A. Only an electronic copy is necessary for this part. Part B (Due Tuesday, December 8, 2015 by 9:40am) The completed project is due by the date and time specified including a printed copy and an electronic copy.

Notes

• You are to use arrays to help you encode and decode your message.

• Do not declare any string variables in your solution. Only char arrays are allowed.

• Be sure to validate all input. Continue asking for input until valid input is given. The secret keys must be uppercase letters.

• Only upper case alphabetic characters are to be encoded and decoded --any other characters are to be left as is and outputted. This includes any punctuation, spaces, returns, etc.

• You need to encode your favorite joke and email the encoded message to me by 9:40 am the day the project is due. In the subject line of the email, specify all the secret keys you use (at least 5).

• At least one encoded file will be placed on Grace a few days before the assignment is due. To complete this assignment you must submit the following: 1. An electronic copy of your program on Grace

a. Add a new project named 07_Cryptography to your previously created assignment solution called PUNetIDAssignments. It is vital that you name your project correctly!

b. Type your program (fully documented/commented) into the project. You must follow the coding standards!

c. Pay attention to the example output! Your program’s output must look exactly like the example output! The spacing and newlines in your output must match exactly.

d. Make sure that your program compiles and runs correctly. If you get any errors, double check that you typed everything correctly.

e. Make sure that your program does not produce any warnings. f. Once you are sure that the program works correctly it is time to submit your program. You do

this by logging on to Grace and placing your complete solution folder in the CS150-01 Drop folder. This solution folder must contain previous assignments.

g. The solution must be in the drop folder by 9:40am on the day that it is due. Remember, there is no late grace period for this last assignment.

2. A hard copy of your program a. The hard copy must be placed on the instructor’s desk by 9:40am on the day that it is due. b. The hard copy must be printed in color, double-sided, and stapled if necessary. c. Your tab size must be set to 2 and you must not go past column 80 in your output.

Good luck! And remember, if you have any problems, come and see me straight away. START EARLY!!

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Instant Assignment Writer
Assignment Solver
A+GRADE HELPER
Financial Assignments
Math Exam Success
WRITING LAND
Writer Writer Name Offer Chat
Instant Assignment Writer

ONLINE

Instant Assignment Writer

I reckon that I can perfectly carry this project for you! I am a research writer and have been writing academic papers, business reports, plans, literature review, reports and others for the past 1 decade.

$31 Chat With Writer
Assignment Solver

ONLINE

Assignment Solver

I have done dissertations, thesis, reports related to these topics, and I cover all the CHAPTERS accordingly and provide proper updates on the project.

$39 Chat With Writer
A+GRADE HELPER

ONLINE

A+GRADE HELPER

I have done dissertations, thesis, reports related to these topics, and I cover all the CHAPTERS accordingly and provide proper updates on the project.

$24 Chat With Writer
Financial Assignments

ONLINE

Financial Assignments

I am a professional and experienced writer and I have written research reports, proposals, essays, thesis and dissertations on a variety of topics.

$36 Chat With Writer
Math Exam Success

ONLINE

Math Exam Success

After reading your project details, I feel myself as the best option for you to fulfill this project with 100 percent perfection.

$31 Chat With Writer
WRITING LAND

ONLINE

WRITING LAND

I have read your project details and I can provide you QUALITY WORK within your given timeline and budget.

$26 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Implicaciones etico legales - Discussion - Wgu c361 task 1 2018 - Emerging Threats counterness - Small Scale Literature Review - What extinguisher to use on electrical fire - Aspermia is the term used to describe - Cpc homework - Integral DX - 2014 hsc physics paper - Risk Management - Stewart road car park sheffield - Essay of accessing the representation of disabled people in a media example - Naap basic coordinates and motions answer key - Questions - Introduction to java programming and data structures 11th edition pdf - Brazil imagined 1500 to the present - My birkbeck profile login - Devils diciples mc rivals - John mayer steve jobs - Fair minded qualities - Mona lisa smile movie - Integrating sources activity - Research Method Project 2 - Biology review answer key - Sexual reproduction increases genetic variability through - Litterature - Ph affect enzyme activity lab report - How do impurities affect boiling point - Hesi maternity - Vce physics formula sheet 2019 - 12 angry men act 2 questions - Amex free trolley sydney airport - C9 - Uses of personal and family resources - Bed bath and beyond back scratcher - Principles of computer system design - S&s in chapter database - A right circular cone and a right circular cylinder - 2013 core knowledge foundation unit 1 - Reviews on walden university nurse practitioner program - Graco husky 1050 wont pump - How are the roles of men and women portrayed in the short story “The Story of an Hour” by Kate Chopin?? Are they distinctly different? Do they have equal rights? What gender expectations do they follow or fight against? whats Chopin comment - Oblique drawing definition example - Database proposal - Fama french three factor model excel - Jaya jagatambe ma durga meaning - Political science - Jean watson carative factors definition - Access Control Reflection in Work Environment - What are the importance of family resources - Which of the following would be a proposition of fact - Fact finding techniques in database - Zipcar creating value in the marketplace - Assignment cover page format - What does a snake symbolize in literature - Two Discussion Responses Needed 100 words each 200 words total - Thor hanson feathers sat answers - Pangea puzzle answer key - What are the needs and wants of ancient communities - Why does hydrochloric acid and sodium thiosulphate react - Wiltshire butterfly conservation sightings - How to make titration curve on excel - Mafic minerals in thin section - X - Cecilius calvert envisioned maryland as a refuge for - Mi madre (1) en que (2) una dieta. - Exam for Organizational Behavior - Atomic number and atomic mass worksheet - Socrates thought of himself as an intellectual midwife because _______ - Novice of mysteries earn the voice of set - Volkswagen cornering lights failure - Ib extended essay rubric - Political Science: Developing Organizations and Leaders - Senior project for physics bachelors level - An object is a ____ of a class - 38 sydney avenue forrest - The best leadership style for unfavorable conditions is - Soontjen racing pigeons for sale - Journey of a red blood cell - Www vodafone com au login - Data to drive instruction - PPT - Heroes with a mission bumppo and batman answers - Cover letter for clerkship - Indiana university plagiarism test certificate answers 2018 - Bus Cont Plan&Disas Recov Plan (ISOL-632-A04) - Phd In Information Technology - Daniel liang introduction to java programming 11th edition pdf - Is universal indicator flammable - Fun facts about the department of transportation - Shooting dad sarah vowell - Rhetorical fallacies in the workplace - Mr wingfield in the glass menagerie - How to make a wayfarer tent - How is pleasantville a dystopia - Health Org D1 - Amanda wilkinson winn dixie - Edu - 18 24 36 lcm - Pr 6 2b lifo perpetual inventory