Here you can find the source of generateHash(String pText)
public static String generateHash(String pText) throws Exception
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; public class Main { private static final char[] DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; public static String generateHash(String pText) throws Exception { String hashValue = null;/*from ww w .ja v a2 s . c o m*/ MessageDigest md = MessageDigest.getInstance("SHA-1"); md.reset(); md.update(pText.getBytes("ASCII")); hashValue = encodeHex(md.digest()); return hashValue; } private static String encodeHex(byte[] pData) { int l = pData.length; char[] out = new char[l << 1]; // two characters form the hex value. for (int i = 0, j = 0; i < l; i++) { out[j++] = DIGITS[(0xF0 & pData[i]) >>> 4]; out[j++] = DIGITS[0x0F & pData[i]]; } return new String(out); } }