Question

show a flow chart explaining the MD5 Algorithm coded in java.

show a flow chart explaining the MD5 Algorithm coded in java.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MD5 ( Message Digest Algorithm ): It was developed by Ronald L. Rivest in 1991. According to RFC 1321, "MD5 message-digest algorithm takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or message digest of the input".

MD5 Algorithm Structure:

MD5 Algorithm Steps:

Step1- The input message is "padded" so that its length equals to 448 mod 512. Padding is always performed, even if the length of the message is already 448 mod 512. A single "1" bit is appended to the message, and then "0" bits are appended so that the length in bits of the padded message becomes congruent to 448 mod 512. At least one bit and at most 512 bits are appended.

Step 2- A 64-bit representation of the length of the message is appended to the result of step1. If the length of the message is greater than 2^64, only the low-order64 bits will be used. The resulting message (after padding with bits and with b) has a length that is an exact multiple of 512 bits. The input message will have a length that is an exact multiple of 16 (32-bit) words.

Step 3- A4 word buffer (A, B, C, D) is used to compute the message digest. Each A, B, C, D is a 32- bit register. These registers are initialized to the following values in hexadecimal, low-order bytes first:

word A: 01 23 45 67

word B: 89 ab cd ef

word C: fe dc ba 98

word D: 76 54 32 10

Step 4: Four functions will be defined such that each function takes an input of three 32-bit words and produces a 32-bit word output.

F(X, Y, Z) = XY or not (X)Z

G(X, Y. Z) = XZ or Y not(Z)

H(X, Y, Z)=X xor Y xor Z

I(X, Y, Z) =Y xor (X or not(Z))

MD5 Algorithm implementation in Java:

import java.math.BigInteger;

import java.security.MessageDigest;

import java.security.NoSuchAlgorithmException;

public class MD5ProgramInJava {

public static void main(String[] args) {

System.out.println("For null Value : " + md5Call(""));

System.out.println("For simple text Value : "+ md5Call("text is here"));

System.out.println("For simple numbers Values : " + md5Call("54321"));

}

public static String md5Call(String input) {

String md5 = null;

if(null == input){ return null;}

try {

//Create MessageDigest object for MD5

MessageDigest digest = MessageDigest.getInstance("MD5");

//Update input string in message digest

digest.update(input.getBytes(), 0, input.length());

//Converts message digest value in base 16 (hex)

md5 = new BigInteger(1, digest.digest()).toString(16);

}

catch (NoSuchAlgorithmException e) {

System.out.pritnln(e);

}

return md5;

}

}

Add a comment
Know the answer?
Add Answer to:
show a flow chart explaining the MD5 Algorithm coded in java.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT