Question: Implement the prepareMessage ( ) method that prepares the message for hashing by padding it . / * Given a file name, use the six

Implement the prepareMessage() method that prepares the message for hashing by padding it.
/* Given a file name, use the six previous methods to read the bytes of the
* message from the file, add the padding to this message (in two steps),
* then convert the result to longs, and return them.
* This method must also send debugging information to the output stream,
* including a one-line message followed by the byte or long values after
* each preprocessing step. The format of this output must match EXACTLY the
* one shown in the handout. Note that the four byte or long arrays may
* only be output if their length is less than 300. However, the one-line
* message must always be output.
*/
static long[] prepareMessage(String filename)
{
/* To be completed */
return null; // remove this line after completing this method
}// prepareMessage method
Here is the output that your code must produce EXACTLY (including spaces, etc.) when called on the file test1.txt:
Original message contains 11 bytes.
303132333435363738390A
Extended message contains 128 bytes.
303132333435363738390A 000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
Padded message contains 128 bytes.
303132333435363738390A 800000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000058
Padded message contains 1 blocks or 16 longs.
303132333435363738390A800000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000058
Here is the output that your code must produce EXACTLY (including spaces, etc.) when called on the file test2.txt:
Original message contains 137 bytes.
54686973206D 65737361676520636F 6E 7461696E 73206D 6F 7265207468616E 20
6F 6E 652074686F 7573616E 64207477656E 747920666F 75722062797465732062
7574206665776572207468616E 2074776F 2074686F 7573616E 6420666F 727479
20656967687420627974657320616E 642077696C 6C 206F 63637570792074776F
20626C 6F 636B 732E 0A
Extended message contains 256 bytes.
54686973206D 65737361

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!