Here you can find the source of generateHash(String item)
public static String generateHash(String item) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String generateHash(String item) throws NoSuchAlgorithmException { String generatedPassword = null; try {/*from ww w.ja v a 2 s .c om*/ MessageDigest md = MessageDigest.getInstance("MD5"); md.update(item.getBytes()); byte[] bytes = md.digest(); generatedPassword = ByteArrayToString(bytes); } catch (NoSuchAlgorithmException e) { throw new NoSuchAlgorithmException(e); } return generatedPassword; } private static String ByteArrayToString(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1)); } return sb.toString(); } }