Write a program that calculates and prints the hash

Assignment Help Assembly Language
Reference no: EM133105211

Assignment A: Implement "diff" in assembly

For this exercise you will implement the Unix "diff" program in assembly. The purpose of the diff program is to compare two files line by line and show all the differences between them. As a sample output, consider the following two files:

Hi, this is a testfile.                                       Hi, this is a testfile.

Testfile 1 to be precise.                                  Testfile 2 to be precise.

The resulting output of diff is then:

$ diff testfile1 testfile2
2c2
< Testfile 1 to be precise.
---
> Testfile 2 to be precise.

As you can see it tells us that the second line is different (2c2 means that line 2 in the original has been changed to become line 2 in the new file). For more information on how the diff command works, please check the diff manuals (type man diff in a terminal or search for man diff online)

For this assignment your program will have to be able to do the following:

Implement a line-by-line comparison version of diff. This means it is not required to have the a and d outputs that the real diff offers. Only the changes will suffice, though we encourage you to also try the detection of addition and deletion of lines.

Implement at least the -i and -B options that diff offers (ignore case and ignore blank lines, respectively). For more details, read the diff man page or try some test cases with an existing diff implementation.

Note : It is not required that you read text from a file or the standard input. It is allowed for you to hardcode the texts you are comparing in your source. If you do this however, the student assistants will change this hardcoded text to confirm that your program works for different texts as well. Similarly, you do not need to read the -i and -B options from the command line. It is allowed to hardcode these as boolean values at the top of your source code, but student assistants will ask you to demonstrate both options (even combined).

Assignment B: Implement a hashing function

Important: you can only get points for either assignment 5a or assignment 5b, not both. Please read both assignments before picking which you want to attempt.

For this assignment, implement a program to calculate a hash such as SHA-1, SHA-256, MD4, MD5, or any other hash you like, of the input given to the program. If you do not know what a hash function is, Google a bit first.

Exercise:

Choose a well known hashing algorithm, and write a program that calculates and prints the hash of the input given to the program. (From standard input or from a file.)

Optional help from our side for SHA-1:

Read the Wikipedia page about SHA-14 (especially the pseudo code). As you will see, the algo- rithm has to split up the data up in 512-bit chunks, and then process each chunk separately. In this simplified exercise, you will only implement the function to process a chunk. The rest of the code is provided by us.

Our part of the code can be downloaded from Canvas. You can combine this with your own code by adding "./sha1 test64.so"5 as another parameter to gcc. Our code does everything until and including the line "break chunk into sixteen . . ." in the pseudo code on Wikipedia. The command used to compile your code could like something like this: gcc -o test my_sha1_chunk.s ./sha1_test64.so -no-pie

Your part of the code should not have a main function, but instead have a sha1 chunk function, which will be called by our part of the code. This sha1 chunk function takes two parameters: First, the address of h0 (h1, h2, etc. are stored directly after h0).

Second, the address of the first 32-bit word of an array of 80 32-bit words. The first sixteen of this array are set to the sixteen 32-bit words the chunk contains (which are called w[0] till w[15]). Your function should modify h0 till h4 as described in the pseudo code.

When you execute the combined program, our part of the code prints a lot of information on what is happening, and when your function is called. It displays the result of your function, and whether that is correct or not. You can of course print more debugging information from your own function using printf.

Reference no: EM133105211

Questions Cloud

Explanation of food hygiene in a education setting : Give an explanation of food hygiene in a education setting.
Visual communication skills : Demonstrate your critical thinking, research, and visual communication skills by taking your topic of choice: MEANING AND PURPOSE,
Maintain a education classroom : Explain why these are necessary and provide practical evidence of what your participation in these activities could be.
Prepare a reconciliation of all changes in the SAR liability : At December 31, 2019, HSC's management had estimated that a total of 2,500 SARs would vest. Prepare a reconciliation of all changes in the SAR liability
Write a program that calculates and prints the hash : Write a program that calculates and prints the hash of the input given to the program and calculate a hash such as SHA-1, SHA-256, MD4, MD5
Strengths or weaknesses of the organization : What are the opportunities and threats that could impact the organization? What are the strengths or weaknesses of the organization?
What should be the price of the bond : A $1,000 bond has a 8% coupon and matures after 10 years. Current interest rates are 10%, what should be the price of the bond
What is the name of the phenomenon : What is the name of the phenomenon by which the Singapore profits resulted in the elimination of the excess credits on the Chinese profits
Use of linkedin for students : Online privacy and publishing a LinkedIn profile state its reason for and against the use of LinkedIn for students and in conclusion support one of the side wit

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