Here you can find the source of getHash(String s)
public static String getHash(String s)
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; public class Main { public static String getHash(String s) { try {/* ww w .j a v a2 s.c o m*/ MessageDigest algorithm = MessageDigest.getInstance("MD5"); algorithm.reset(); algorithm.update(s.getBytes()); byte[] hashDigest = algorithm.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < hashDigest.length; i++) { String hex = Integer.toHexString(0xFF & hashDigest[i]); if (hex.length() == 1) { hex = "0" + hex; } hexString.append(hex); } return hexString.toString(); } catch (Exception e) { e.printStackTrace(); } return null; } }