Write a c program to implement a substitution cipher

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

Assignment

Write a C program to implement a substitution cipher to encrypt plain text:

• Select a string of characters to use as the cipher key, which must be 2 to 16 characters in length and contains only lower case characters of the alphabet (a-z) without any duplicates

• Select a string of plain text to encrypt, which must be 4 to 256 characters in length and contains only lower case characters of the alphabet (a-z) and spaces

• Use N to indicate the current position in the cipher key, where the starting position (first character) is indicated by N equal to 1.

• Perform the encryption by implementing these steps from the start of the cipher key:

1) The character found at position N in the cipher key is the target value

2) The character found at position N+1 in the cipher key is the substitution value; in the situation that N is the last character in the cipher key, then, the substitution value is the first character of the cipher key

3) In the plain text, replace all instances of the target value with the substitution value

4) Increase N by one and repeat all steps until the end of the cipher key The program must read the following input:

• 1 st line of input is a number indicating the length of the cipher key
• 2 nd line of input is the cipher key text
• 3 rd line of input is a number indicating the length of the plain text
• 4 th line of input is the plain text to be encrypted The program must display the following output:

• The number of each step, e.g. if the length of the cipher key is 4, then, the output must display substitution steps 1, 2, 3 and 4
• The target value and the substitution value at each step.

• The encrypted text at each substitution step Sample input 2 hg 11 hello world Sample output

Step 1 substitute h with g gello world
Step 2 substitute g with h gello world Sample input 3 hgw 11 hello world Sample output

Step 1 substitute h with g gello world
Step 2 substitute g with w gello world
Step 3 substitute w with h gello horld 2017-18

Sample input

4 hdgw 11 hello world

Sample output

Step 1 substitute h with d dello world
Step 2 substitute d with g dello worlg
Step 3 substitute g with w dello worlg
Step 4 substitute w with h dello horlg

The coursework must contain pseudo code of the solution at the top of the program (enclosed with source code comments delimiters). Source code comments are required to explain the implementation.

Reference no: EM131952501

Questions Cloud

What is sexual perversion and paraphilia : What is sexual perversion and paraphilia? Explicating Thomas Nagel's multi-level interpersonal awareness model, ultimately agree or disagree with his position.
Describe the concept of concurrent engineering : Describe the concept of concurrent engineering. How does concurrent engineering improve the product design process?
Life course theory in relation to diversity and integration : Where would be a good place to find information on Life Course Theory in relation to diversity and integration?
Work of ernst heinrich weber-hermann von helmholtz : Discuss how the work of Ernst Heinrich Weber, Hermann von Helmholtz, and Gustav Theodor Fechner in physiology laid the foundation for the development
Write a c program to implement a substitution cipher : Write a C program to implement a substitution cipher to encrypt plain text: Select a string of characters to use as cipher key, which must be 2 to 16 character.
What is meant by design for manufacture : What is meant by design for manufacture? The design for maintainability concept states that a product should be designed in a way that makes it easy.
Comment on the marketing mix of jks premium herbal shampoos : The company has planned only point of purchase (POP) posters initially and may consider the electronic media later.
Nature of divorce in agricultural states : Do you see any parallels, or is divorce simply a cultural facet that does not relate to the rest of society?Essay help with Cultural Anthropology.
What is the over-the-wall syndrome : What is the over-the-wall syndrome? How can the over-the-wall syndrome be avoided? Define component reliability and system reliability.

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