Here you can find the source of md5Digest(final String message)
private static String md5Digest(final String message) throws NoSuchAlgorithmException, UnsupportedEncodingException
//package com.java2s; /**/*from w w w . j a v a 2s .c om*/ * Copyright (c) 2011 IETF Trust and the persons identified as authors of the * code. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, is permitted pursuant to, and subject to the license terms * contained in, the Simplified BSD License set forth in Section 4.c of the IETF * Trust's Legal Provisions Relating to IETF Documents * (http://trustee.ietf.org/license-info). */ import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { private static String md5Digest(final String message) throws NoSuchAlgorithmException, UnsupportedEncodingException { String digest; MessageDigest md = MessageDigest.getInstance("MD5"); byte[] hash = md.digest(message.getBytes("UTF-8")); //converting byte array to Hexadecimal String StringBuilder sb = new StringBuilder(2 * hash.length); for (byte b : hash) { sb.append(String.format("%02x", b & 0xff)); } digest = sb.toString(); return digest; } }