Java Program to Implement MD5 Hash Value of a String

Here is the example is show quick way to calculate the MD5 hash of a string. I know things with Java have to be well structured and since MD5 is a hashing algorithm it is fairly logical to be in the security package.

So what you have to do it to create an instance of the Message Digest class with the algorithm of MD5, then convert your string to a byte sequence, feed it to the instance that will return a new byte sequence with the MD5 value and convert it accordingly to what we want (here just the hex representation). So let’s get our hands dirty.

MD5 Generator

When you run the program, the output will be:

MD5 in hex: 35e60d78c674c52c3c6d2258135855e3
MD5 in decimal: 281949768489412648962353822266799178366
MD5 in binary: 11010100000111011000110011011001100011110000000010110010000001001

Post a Comment

Thank you for vising

Previous Post Next Post