Here you can find the source of strHash(String value, String method)
public static String strHash(String value, String method)
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.xml.bind.DatatypeConverter; public class Main { public static String strHash(String value, String method) { try {// ww w . j a v a 2 s . c om MessageDigest messageDiges = MessageDigest.getInstance(method); messageDiges.update(value.getBytes()); byte[] buffer = messageDiges.digest(); return DatatypeConverter.printHexBinary(buffer); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Internal Error: No such algorithm"); } } }