Implement a transposition cipher system

Assignment Help Assembly Language
Reference no: EM133271846

Practical work

For this second practical work of the session, we ask you to implement a transposition cipher system: the Myszkowski transpose.

To work, the latter takes a key and text as input, as well as a mode to decide whether to encrypt or decrypt the text entered.

For explanations of the principle and to test on a valid implementation

Specifications

The program will successively ask for the key to use, then the text to be processed, and finally the mode (encrypt or decrypt), before calculating the output text.

The key is a text with a minimum length of 1 character, and a maximum of 8 characters. We don't put any constraints on the text, except that the \x00s won't be in the input.

The text is also a text with a minimum length of 1 character, and a maximum of 150 characters. Here, two constraints:

- Encryption: no \x00, nor =.
- Decryption: no \x00.

Finally the operation mode will be either e to encrypt, and d to decrypt. Note that each entry is on a separate line.

We provide you with the character strings to add in your program, you will have to use them as they are, and display them when it is relevant. The tests will verify that they are exactly equal to what we provide, and we will apply penalties if there is any discrepancy.

Key processing
The Myszkowski cipher relies on a first pass over the key to assign a number to each unique character of the entered key. The order we use to determine how to assign these digits is the lexicographical order. To simplify, we will consider the ASCII codes of each character as their value.

For instance:
A (0x41) < B (0x42) < C (0x43) < a (0x61) < b (0x62) < c (0x63)
Therefore, each unique character in the key will need to be affixed with the correct number in that order.
Examples of keys and numbering:
ABCA -> 1231
CBAB -> 3212
ACBC -> 1323
This numbering method will be used to encrypt and decrypt input texts.

encryption
For encryption to work, you will need to align your key and your input. To do this, add as many = characters as necessary to the end of the input so that the lengths of the key and your input text are equal, modulo the size of the key.
To put this in code: len(text) len(key) == 0. Example:
Key: ABCD (length 4)
Text: sample_text (length 13)
Padded text: sample_text=== (length 16)
To encrypt an input via this method, you will first have to process the key as mentioned in the previous point, then apply this key in a loop over all the characters of the text to be encrypted. For each character, if the current position is equal to the corresponding one in the key, modulo the size of the key, and if the current iteration is the one corresponding to the number assigned to the character matching in the key, you can write that character as the next character in the output.

Here is the pseudocode corresponding to this description:
var output string // encrypted text to be calculated var text string // input text, padded
var cleNum []int // numbers assigned to each character of the key
iteration = 1
outputPosition = 0
while true {
found = false positionText = 0
KeyPosition = 0
while positionText < len(text) {
if keyNum[keyPosition] == iteration { output[outputPos] = text[textPosition] found = true
}
KeyPosition++
if keyPosition >= len(keyNum) { keyPosition = 0
}
positionText++
}

if !found {
break
}
iteration++
}

Decryption
The encryption corollary uses a method similar to encryption, you will need to number the characters of your key. The text entered will not need to be padded, it will have to respect the constraint of len(text) len(key) == 0. To simplify the realization, you can assume that it is valid (we will not test malformed entries).

Once the decryption is functional, you will have an output possibly padded with =. Before displaying the decrypted text to the user, you will need to unalign it: remove all = characters from the output at the end of the string.

Here is the decryption pseudo-code:
var output string // decrypted text to be calculated var text string // encrypted text entered
var cleNum []int // numbers assigned to each character of the key
iteration = 1
inputPosition = 0
while true {
found = false outputPosition = 0
KeyPosition = 0
while outputPosition < len(text) {
if keyNum[keyPosition] == iteration { output[outputPosition] = text[inputPosition] inputPosition++
}
KeyPosition++
if keyPosition >= len(keyNum) { keyPosition = 0
}
outputPosition++
}

if !found {
break
}
iteration++
}

Evaluation
This practical work counts for 15% of the final grade of the course.

In detail, here are the evaluation criteria that we will take into account:

Program operation
We deliver tests to you with this TP, you will have to pass all the tests we deliver to you, as well as private tests. Markers will also be able to add tests that must be passed to obtain the maximum score.

To run the tests, use the "input" file as input (Batch I/O) in the simulator, and compare the output to the corresponding "output" file. Note that if there are differences in the case of the messages or differences (punctuation, emphasis, etc.), the test will not count as completely failed, but a penalty of up to 50% will be applied to the score for the test.

NOTE: Your program MUST be called myszkowski.pep. If the name does not correspond to this instruction, a global penalty of 15 points will be imposed.

Naming
To carry out the realization of the program, you will probably need to declare labels. As far as possible, and knowing the limits of PEP/8 (8 characters maximum for each), you should name them clearly. This facet will also be taken into account in the rating of your achievement.

Comments
Given that it is assembler, and that the programs are essentially rather obscure, we ask you to comment adequately on your achievements, so that everything is clearer on proofreading. Note that comments should explain your work, not paraphrase your code.

Code quality
Even if it is assembler, we will assess the quality of the code you submit. We will sanction any unnecessary complexity, make sure that the code you render is as clear and concise as possible, without hindering the reading.

Suggestion
Given that the subject is considerably more complex than lab1, we do not recommend that you do the lab directly in assembler. To cement the algorithm to be written, we suggest that you write a first implementation in a higher level language (Java, C, Python, etc.), applying constraints: do not use library functions that you will not be able to use in Assembler directly (for example Maps, Sets, etc.). You will eventually be able to use reading primitives that come with these languages, but keep in mind that you will have to reimplement them in assembler to replicate the operation of the lab.

Attachment:- Cipher system.rar

Reference no: EM133271846

Questions Cloud

What is the most essential nursing interventions : What is the most essential nursing interventions for this patient's situation? Provide rationales for all nursing interventions and teaching needs
How can organizations cultivate communities of practice : How can organizations cultivate communities of practice? How can these communities of practice contribute towards the knowledge needs of the organization
Describe the concept of communities of practice : Communities of Practice Discussion - Describe the concept of Communities of Practice. Why are "Communities of practice" Important
What are major steps involved in developing a km strategy : What are the major steps involved in developing a KM strategy? What sorts of information is needed to recommend a KM strategy to an organization
Implement a transposition cipher system : Implement a transposition cipher system - provide you with the character strings to add in your program, you will have to use them as they are, and display them
Why co-branding is an important strategy : Why Co-Branding is an important strategy for the marketers? How does it work? Discuss with the help of some examples
Discuss the different types of financial intermediaries : Read the article - Financial Intermediary Article by Wallstreetmojo Editorial Team. Discuss the different types of financial intermediaries
What are major challenges in supply chain management today : What are the Major Challenges in Supply Chain Management today? How Can you Overcome them
Explain the role of technology in supply chain management : Explain the role of technology in Supply chain Management with special focus on Block chain technology

Reviews

Write a Review

Assembly Language Questions & Answers

  Write a python function to simulate selecting n people

Write a Python function to simulate selecting n people at random and checking the probability of having at least two people with the same birthday.

  Development process and the implementation of program

Development process and the implementation of a simple, non-trivial example program. In the subsequent exercises you can borrow ideas

  Create a program that functions as simple boolean calculator

Write a program that clears the screen, locates the cursor near the middle of the screen, prompts the user for two integers, adds the integers, and displays

  Show where biased coloring helps make the right decisions

Use both conservative coalescing and biased coloring in allocating registers. Show where biased coloring helps make the right decisions.

  Integral square root of an input number

Write a short assembly program that computes the integral square root of an input number and In this problem you will write a program that will compute the first 20 numbers in the Fibonacci sequence.

  Explain high level and assembly level language

Explain high level and assembly level language, understand the data representation for fractions, signed, floating point number, etc.

  What problems would have to be solved to do it the other way

Most assemblers for the x86 have the destination address as the first operand and the source address as the second operand. What problems would have to be solved to do it the other way?

  Explain about the ascii functions

Explain about the ASCII functions we use in assembly language programming

  Homework assignment on numerical representations

Create an assembly language function that displays the binary and hexadecimal representations of a 16 bit value (passed in as a parameter) on our LCD screen. Use the provided .c main file and assembly language subroutine example as a basis for you..

  Write a set of assembly codes in uvision

Write a set of assembly codes in uVision that performs the function described below. Begin with the assumption that 10 randomly selected integer numbers (data) are stored at 0x20002000 to 0x20002024 in sequence in the memory region.

  Write a program sequence that places the value in address

write a program sequence that places the value in address 1000 into accumulator a and places the value in address 1001

  Program that requests n as input

Write a program that requests N as input and computes the left-hand and the right-hand sides of the equation, verifies that they are equal, and displays the result.

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