MessageDigest - Autogenerated Crowd Documention

"MessageDigest is your friend. Call getInstance("MD5") to get an MD5 message digest you can use."

Top Threads

30 In Java, how do I convert a byte array to a string of hex digits while keeping leading zeros?

23 Performance of ThreadLocal variable

18 How do I use 3des encryption/decryption in Java?

16 Using SHA1 and RSA with java.security.Signature vs. MessageDigest and Cipher

12 How do you determine the ideal buffer size when using FileInputStream?

Popular Snippet


public static String MD5hash(String text) throws NoSuchAlgorithmException {
    byte[] hash = MessageDigest.getInstance("MD5").digest(text.getBytes());
    return String.format("%032x",new BigInteger(1, hash));
}

Other Resources

http://commons.apache.org/codec/apidocs/org/apache/commons/codec/digest/DigestUtils.html

http://download.oracle.com/javase/6/docs/api/java/security/MessageDigest.html

http://stackoverflow.com/questions/415953/generate-md5-hash-in-java

http://en.wikipedia.org/wiki/MD5

https://www.owasp.org/index.php/Hashing_Java