Here you can find the source of generateHash(String input)
public static String generateHash(String input)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { /**/* www . j a v a2s . c om*/ * Pre: input!=null * Post: Genera un Hash para el texto pasado. * Fuente: http://viralpatel.net/blogs/java-md5-hashing-salting-password/ */ public static String generateHash(String input) { String md5 = null; if (null == input) return null; try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(input.getBytes(), 0, input.length()); md5 = new BigInteger(1, digest.digest()).toString(16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return md5; } }