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

  Create a assembly language subroutine

Create a assembly language subroutine MULSUM that takes an array named A containing n bytes of positive numbers, and fills two arrays, array B containing n words and array C containing n long words

  Write a function in linux assembly

Write a function in Linux assembly

  Analog measurements

Prepare an assembly program for the correctly measures the wind direction

  Design a simple digital clock

Design a simple digital clock

  Write an assembly program

Prepare an Assembly program that reads in a number of cents.

  Write an assembly language program

Write an assembly language program for encrypting alphabates of a string

  Greatest common divisor of integers-masm assembly language

Must be done in MASM assembly language: Greatest common divisor of two integers is largest integer which will evenly divide both integers. GCD algorithm involves integer division in a loop.

  Write assembly program-find right admission price to movie

Write the Assembly program to find correct admission price to movie. Price of admission to a movie is $7 for kids (under 12) and $9 for adults.

  Create simple 8-bit alu using add-subtract-shift functions

Create a simple 8-bit ALU. Requirements:The eight functions that you will implement are: add, subtract, and, or, shift left logical, less than, shift right logical.

  Write assembly program print binary representation-integers

Write the assembly program called hw6_ex1, stored in file hw6_ex1.asm. This program must prompt user to enter signed 32-bit integer. Program must print out binary representation of the integer.

  Allot op-codes and add microcode to microprogram

Allot op-codes and add microcode to microprogram of Mic-1 to implement following instructions which are then included with IJVM instruction set.

  Write mips assembly program to read two non-negative numbers

Write MIPS assembly program to repeatedly read two non-negative integers and print integer product and quotient without using multiplication and division instructions.

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