Here you can find the source of getHash(String message)
public static String getHash(String message)
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; public class Main { public static String getHash(String message) { return getHash(message, "MD5"); }//from w w w.ja va 2 s . c o m public static String getHash(String message, String type) { StringBuilder sBuilder = null; try { MessageDigest messageDigest = MessageDigest.getInstance(type); messageDigest.update(message.getBytes()); sBuilder = new StringBuilder(); for (byte b : messageDigest.digest()) { sBuilder.append(String.format("%02X", b)); } } catch (Exception e) { e.printStackTrace(); } return sBuilder.toString(); } }