1

I need to implement a method to find the MD5 hash of the bytes of the given String. It seems to me that this class is included in the package called com.starbase.util.MD5, but could not find where to download a jar file. Could someone point me to the right place?

flyingfromchina
  • 9,571
  • 12
  • 35
  • 38

4 Answers4

2

Use Java's built-in MessageDigest. Here's an example (koregan's post) of how to use a MessageDigest with MD5 to hash a String.

Community
  • 1
  • 1
Kaleb Brasee
  • 51,193
  • 8
  • 108
  • 113
1

Apache commons coding are the best solution.

The code is as simple as:

String hex = DigestUtils.md5Hex(yourString);
FolksLord
  • 992
  • 2
  • 9
  • 17
0

Check out the java.security.MessageDigest class. It provides several hash functions.

svenningsson
  • 4,009
  • 1
  • 24
  • 32
0
String myHash= org.apache.commons.codec.digest.DigestUtils.md5Hex("toBeHashed")

from common-codec : https://commons.apache.org/proper/commons-codec/

SLI
  • 1
  • 1